結果
問題 | No.406 鴨等間隔の法則 |
ユーザー |
|
提出日時 | 2016-08-13 13:57:08 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 19 ms / 2,000 ms |
コード長 | 532 bytes |
コンパイル時間 | 1,251 ms |
コンパイル使用メモリ | 163,460 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-07 11:37:11 |
合計ジャッジ時間 | 2,390 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:4:28: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 4 | #define INT(n) int n; scanf("%d",&n); | ~~~~~^~~~~~~~~ main.cpp:11:3: note: in expansion of macro ‘INT’ 11 | INT(n); VI(xs, n); | ^~~ main.cpp:5:61: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | #define VI(v,n) vector<int> v(n); for(int i=0;i<n;i++){scanf("%d",&v[i]);} | ~~~~~^~~~~~~~~~~~ main.cpp:11:11: note: in expansion of macro ‘VI’ 11 | INT(n); VI(xs, n); | ^~
ソースコード
#include <bits/stdc++.h>using namespace std;#define INT(n) int n; scanf("%d",&n);#define VI(v,n) vector<int> v(n); for(int i=0;i<n;i++){scanf("%d",&v[i]);}#define FOR(var,a,b) for(int var=(a);var<(b);var++)#define SZ(a) int((a).size())#define SORT(c) sort((c).begin(),(c).end())int main(){INT(n); VI(xs, n);SORT(xs);int dif = xs[1] - xs[0];string ans = dif == 0 ? "NO" : "YES";FOR(i, 2, SZ(xs)){if (xs[i] - xs[i - 1] != dif){ans = "NO";break;}}cout << ans << endl;return 0;}