結果
問題 |
No.742 にゃんにゃんにゃん 猫の挨拶
|
ユーザー |
|
提出日時 | 2018-10-05 23:01:33 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 984 bytes |
コンパイル時間 | 523 ms |
コンパイル使用メモリ | 54,748 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-10-12 13:58:18 |
合計ジャッジ時間 | 2,098 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 WA * 4 RE * 8 |
ソースコード
#include<iostream> #include<string> using namespace std; #define int long long #define rep(i,n) for(int i = 0; i < n; i++) #define INF (long long)(1e18) #define MOD (int)(1e9+7) #define MAX_V 10 signed main(){ int temp[3][MAX_V] = {}, N, M, count = 0; cin>>N; for(int i = 1; i <= N; i++){ cin>>M; if(M > i){ temp[0][i]++; temp[0][M]--; }else if(M < i){ temp[1][i+1]--; temp[1][M+1]++; } else temp[2][M]++; } for(int j = 1; j < MAX_V; j++){ temp[0][j] += temp[0][j-1]; temp[1][j] += temp[1][j-1]; } for(int j = 1; j < MAX_V; j++){ int f = (temp[0][j]?1:0) + (temp[1][j]?1:0) + (temp[2][j]?1:0); //if(temp[0][j] || temp[1][j] || temp[2][j]) // if(!((!temp[0][j]&&!temp[1][j])||(!temp[1][j]&&!temp[2][j])||(!temp[2][j]&&!temp[0][j]))) // if(f >= 2) count += temp[0][j]*temp[1][j] + temp[1][j]*temp[2][j] + temp[2][j]*temp[0][j]; //cout<<temp[0][j]<<" "<<temp[1][j]<<" "<<temp[2][j]<<endl; } cout<<count<<endl; return 0; }