結果
問題 | No.406 鴨等間隔の法則 |
ユーザー |
|
提出日時 | 2016-08-13 13:54:05 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 514 bytes |
コンパイル時間 | 1,410 ms |
コンパイル使用メモリ | 162,412 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 05:15:44 |
合計ジャッジ時間 | 2,906 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 27 WA * 2 |
コンパイルメッセージ
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);string ans = "YES";int dif = xs[1] - xs[0];FOR(i, 2, SZ(xs)){if (xs[i] - xs[i - 1] != dif){ans = "NO";break;}}cout << ans << endl;return 0;}