結果
| 問題 |
No.406 鴨等間隔の法則
|
| コンテスト | |
| ユーザー |
sasa
|
| 提出日時 | 2025-03-17 14:11:36 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 628 bytes |
| コンパイル時間 | 343 ms |
| コンパイル使用メモリ | 28,288 KB |
| 実行使用メモリ | 14,904 KB |
| 最終ジャッジ日時 | 2025-03-17 14:11:41 |
| 合計ジャッジ時間 | 5,192 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 11 TLE * 1 -- * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:4:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
4 | scanf("%ld",&val);
| ~~~~~^~~~~~~~~~~~
main.cpp:8:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | scanf("%ld",&loc[i]);
| ~~~~~^~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
int main(void){
long val = 0;
scanf("%ld",&val);
long loc[val];
for(long i = 0;i < val;i ++){
scanf("%ld",&loc[i]);
}
printf("\n");
for(long i = 0;i < val;i ++){
for(long j = 0;j < val;j ++){
if(loc[i] == loc[j] && i != j){
printf("NO");
return 0;
}
}
}
for(long i = 0;i < val;i ++){
for(long j = 0;j < val;j ++){
if(loc[i] < loc[j]){
int tmp = loc[i];
loc[i] = loc[j];
loc[j] = tmp;
}
}
}
long interval = loc[1] - loc[0];
for(int i = 2;i < val;i ++){
if(interval != (loc[i] - loc[i - 1])){
printf("NO");
return 0;
}
}
printf("YES");
}
sasa