結果
| 問題 |
No.482 あなたの名は
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-02-10 23:43:05 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 28 ms / 2,000 ms |
| コード長 | 325 bytes |
| コンパイル時間 | 346 ms |
| コンパイル使用メモリ | 20,992 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-29 20:22:16 |
| 合計ジャッジ時間 | 2,092 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%llu%llu",&n,&k);
| ^~~~~~~~~~~~~~~~~~~~~~~
main.c:7:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%llu",&m);d[i] = m;
| ^~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int main(void){
unsigned long long int n,k,d[262144],i,m,c=0;
scanf("%llu%llu",&n,&k);
for(i = 1;i <= n;i++){
scanf("%llu",&m);d[i] = m;
}
for(i = 1;i <= n;i++){
while(i != d[i]){m = d[i];d[i] = d[m];d[m] = m;c++;}
}
if(k >= c && (k-c)%2 == 0){printf("YES\n");}else{printf("NO\n");}
return 0;
}