結果
| 問題 | No.833 かっこいい電車 |
| コンテスト | |
| ユーザー |
ritsu2891
|
| 提出日時 | 2019-06-09 14:57:02 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,314 bytes |
| 記録 | |
| コンパイル時間 | 671 ms |
| コンパイル使用メモリ | 69,760 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-02 03:57:13 |
| 合計ジャッジ時間 | 8,596 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 11 WA * 18 TLE * 1 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
void ParseQuery(int QueryId, int x);
void Connect(int x);
void Separate(int x);
void Remodel(int x);
void Attr(int x);
std::vector<int> CoolVals;
std::vector<int> ConnectInfo;
int main() {
int CarQty, QueryQty;
scanf("%d%d", &CarQty, &QueryQty);
for (int i = 0; i < CarQty; i++) {
int Val;
scanf("%d", &Val);
CoolVals.push_back(Val);
ConnectInfo.push_back(false);
}
while (QueryQty-->0) {
int QueryId, x;
scanf("%d%d", &QueryId, &x);
ParseQuery(QueryId, x-1);
}
return 0;
}
void ParseQuery(int QueryId, int x) {
switch (QueryId)
{
case 1:
Connect(x);
break;
case 2:
Separate(x);
break;
case 3:
Remodel(x);
break;
case 4:
Attr(x);
break;
default:
break;
}
}
void Connect(int x) {
ConnectInfo[x] = true;
}
void Separate(int x) {
ConnectInfo[x] = false;
}
void Remodel(int x) {
CoolVals[x]++;
}
void Attr(int x) {
int CarPos = x;
while (CarPos != 0 && ConnectInfo[CarPos-1] == true) {
CarPos--;
}
int Attr = 0;
do {
Attr += CoolVals[CarPos];
} while (ConnectInfo[CarPos++] == true);
printf("%d\n", Attr);
}
ritsu2891