提出 #33270105
ソースコード 拡げる
#include <atcoder/all>
using namespace atcoder;
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = 3.14159265359;
const ll INF = 1LL << 60;
int main()
{
int n, m;
cin >> n >> m;
vector<int> a(m);
vector<int> b(m);
for (int i = 0; i < m; i++){
cin >> a[i] >> b[i];
a[i]--;
b[i]--;
}
vector<pair<int, int>> v(n, make_pair(-1, 1));
int q;
cin >> q;
vector<int> x(q);
vector<int> y(q);
vector<bool> used(n, false);
for (int i = 0; i < q; i++){
cin >> x[i] >> y[i];
x[i]--;
used[x[i]] = true;
}
vector<vector<int>> edges(n);
for (int i = 0; i < m; i++){
if (used[a[i]] && used[b[i]]){
edges[a[i]].push_back(b[i]);
edges[b[i]].push_back(a[i]);
}
}
for (int i = 0; i < q; i++){
auto [j, c] = v[x[i]];
for (int e : edges[x[i]]){
auto [j2, c2] = v[e];
if (j2 > j){
j = j2;
c = c2;
}
}
cout << c << endl;
v[x[i]] = make_pair(i, y[i]);
}
return 0;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | 083 - Colorful Graph(★6) |
| ユーザ | unnohideyuki |
| 言語 | C++ (GCC 9.2.1) |
| 得点 | 2 |
| コード長 | 1074 Byte |
| 結果 | TLE |
| 実行時間 | 3308 ms |
| メモリ | 15468 KiB |
ジャッジ結果
| セット名 | Sample | Subtask1 | Subtask2 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 2 / 2 | 0 / 4 | ||||||||
| 結果 |
|
|
|
| セット名 | テストケース |
|---|---|
| Sample | 00_sample_00.txt, 00_sample_01.txt |
| Subtask1 | 11_subtask_00.txt, 11_subtask_01.txt, 11_subtask_02.txt, 11_subtask_03.txt, 11_subtask_04.txt, 11_subtask_05.txt, 11_subtask_06.txt, 11_subtask_07.txt, 11_subtask_08.txt, 11_subtask_09.txt |
| Subtask2 | 00_sample_00.txt, 00_sample_01.txt, 10_random_small_00.txt, 10_random_small_01.txt, 10_random_small_02.txt, 11_random_large_00.txt, 11_random_large_01.txt, 11_random_large_02.txt, 11_subtask_00.txt, 11_subtask_01.txt, 11_subtask_02.txt, 11_subtask_03.txt, 11_subtask_04.txt, 11_subtask_05.txt, 11_subtask_06.txt, 11_subtask_07.txt, 11_subtask_08.txt, 11_subtask_09.txt, 20_random_max_00.txt, 20_random_max_01.txt, 60_random_challenge_00.txt, 60_random_challenge_01.txt, 60_random_challenge_02.txt, 70_random_clique_00.txt, 70_random_clique_01.txt, 80_random_tree_00.txt, 90_random_uni_00.txt, 90_random_uni_01.txt, 90_random_uni_02.txt, 99_random_kill_00.txt, 99_random_kill_01.txt, 99_random_kill_02.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 00_sample_00.txt | AC | 1 ms | 3400 KiB |
| 00_sample_01.txt | AC | 2 ms | 3328 KiB |
| 10_random_small_00.txt | AC | 7 ms | 3564 KiB |
| 10_random_small_01.txt | AC | 5 ms | 3456 KiB |
| 10_random_small_02.txt | AC | 2 ms | 3384 KiB |
| 11_random_large_00.txt | AC | 18 ms | 3500 KiB |
| 11_random_large_01.txt | AC | 38 ms | 4120 KiB |
| 11_random_large_02.txt | AC | 60 ms | 4548 KiB |
| 11_subtask_00.txt | AC | 72 ms | 5436 KiB |
| 11_subtask_01.txt | AC | 37 ms | 4384 KiB |
| 11_subtask_02.txt | AC | 40 ms | 4584 KiB |
| 11_subtask_03.txt | AC | 16 ms | 3808 KiB |
| 11_subtask_04.txt | AC | 29 ms | 3720 KiB |
| 11_subtask_05.txt | AC | 61 ms | 5704 KiB |
| 11_subtask_06.txt | AC | 42 ms | 4384 KiB |
| 11_subtask_07.txt | AC | 45 ms | 4380 KiB |
| 11_subtask_08.txt | AC | 32 ms | 3812 KiB |
| 11_subtask_09.txt | AC | 61 ms | 5588 KiB |
| 20_random_max_00.txt | AC | 499 ms | 15468 KiB |
| 20_random_max_01.txt | AC | 504 ms | 15428 KiB |
| 60_random_challenge_00.txt | AC | 442 ms | 6496 KiB |
| 60_random_challenge_01.txt | AC | 427 ms | 5904 KiB |
| 60_random_challenge_02.txt | AC | 402 ms | 5128 KiB |
| 70_random_clique_00.txt | AC | 589 ms | 10352 KiB |
| 70_random_clique_01.txt | AC | 585 ms | 10456 KiB |
| 80_random_tree_00.txt | AC | 391 ms | 5396 KiB |
| 90_random_uni_00.txt | TLE | 3308 ms | 13752 KiB |
| 90_random_uni_01.txt | TLE | 3308 ms | 13600 KiB |
| 90_random_uni_02.txt | TLE | 3308 ms | 13632 KiB |
| 99_random_kill_00.txt | AC | 2439 ms | 10192 KiB |
| 99_random_kill_01.txt | AC | 2500 ms | 10188 KiB |
| 99_random_kill_02.txt | AC | 2505 ms | 10252 KiB |