結果
| 問題 |
No.742 にゃんにゃんにゃん 猫の挨拶
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-10-05 23:16:11 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,001 bytes |
| コンパイル時間 | 420 ms |
| コンパイル使用メモリ | 54,736 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-12 13:58:38 |
| 合計ジャッジ時間 | 2,004 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 WA * 5 RE * 7 |
ソースコード
#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+1]++;
temp[0][M+1]--;
}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][MAX_V-j-1] += temp[1][MAX_V-j];
}
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;
}