結果
| 問題 |
No.406 鴨等間隔の法則
|
| コンテスト | |
| ユーザー |
sasa
|
| 提出日時 | 2025-03-17 14:09:58 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 694 bytes |
| コンパイル時間 | 655 ms |
| コンパイル使用メモリ | 28,928 KB |
| 実行使用メモリ | 7,328 KB |
| 最終ジャッジ日時 | 2025-03-17 14:10:11 |
| 合計ジャッジ時間 | 12,034 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 3 |
| other | WA * 11 TLE * 1 -- * 17 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:16:42: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
16 | printf("%d %d %d",i,loc[i],loc[j]);
| ~^ ~
| | |
| int long int
| %ld
main.cpp:16:45: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
16 | printf("%d %d %d",i,loc[i],loc[j]);
| ~^ ~~~~~~
| | |
| int long int
| %ld
main.cpp:16:48: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long int’ [-Wformat=]
16 | printf("%d %d %d",i,loc[i],loc[j]);
| ~^ ~~~~~~
| | |
| int long int
| %ld
main.cpp:29:25: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long int’ [-Wformat=]
29 | scanf("%d ",loc[i]);
| ~^ ~~~~~~
| | |
| int* long int
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: ignori
ソースコード
#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("%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("%d %d %d",i,loc[i],loc[j]);
printf("NO");
return 0;
}
if(loc[i] < loc[j]){
int tmp = loc[i];
loc[i] = loc[j];
loc[j] = tmp;
}
}
}
for(int i = 0;i < val;i ++){
scanf("%d ",loc[i]);
}
printf("\n");
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