Submission #69836239
Source Code Expand
// Problem: 'C - Upgrade Required' // Contest: 'AtCoder - AtCoder Beginner Contest 426' // URL: 'https://atcoder.jp/contests/abc426/tasks/abc426_c' // Memory Limit: 1024 MB // Time Limit: 2000 ms // // Powered by competitive-companion.el (https://github.com/luishgh/competitive-companion.el) #include <bits/stdc++.h> using namespace std; #define _ ios_base::sync_with_stdio(0);cin.tie(0); #define endl '\n' typedef long long ll; const int INF = 0x3f3f3f3f; const ll LINF = 0x3f3f3f3f3f3f3f3fll; int main() {_; int n, q; cin >> n >> q; vector<int> freq(n, 1); int cur = 0; while (q--) { int x, y; cin >> x >> y; x--, y--; // cerr << "CUR " << cur + 1 << endl; if (x < cur) { cout << 0 << endl; continue; } int acc = 0; for (int i = cur; i <= x; i++) { acc+= freq[i]; } cur = x + 1; cout << acc << endl; freq[y] += acc; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Upgrade Required |
User | luishgh |
Language | C++ 20 (gcc 12.2) |
Score | 300 |
Code Size | 964 Byte |
Status | AC |
Exec Time | 30 ms |
Memory | 7136 KiB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01.txt |
All | hand_01.txt, hand_02.txt, hand_03.txt, sample_01.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
hand_01.txt | AC | 26 ms | 6992 KiB |
hand_02.txt | AC | 26 ms | 7028 KiB |
hand_03.txt | AC | 27 ms | 7032 KiB |
sample_01.txt | AC | 1 ms | 3420 KiB |
test_01.txt | AC | 1 ms | 3464 KiB |
test_02.txt | AC | 28 ms | 7076 KiB |
test_03.txt | AC | 27 ms | 7016 KiB |
test_04.txt | AC | 27 ms | 7132 KiB |
test_05.txt | AC | 27 ms | 7132 KiB |
test_06.txt | AC | 27 ms | 7136 KiB |
test_07.txt | AC | 27 ms | 7004 KiB |
test_08.txt | AC | 28 ms | 6948 KiB |
test_09.txt | AC | 28 ms | 7128 KiB |
test_10.txt | AC | 21 ms | 3432 KiB |
test_11.txt | AC | 21 ms | 3476 KiB |
test_12.txt | AC | 21 ms | 3504 KiB |
test_13.txt | AC | 21 ms | 3428 KiB |
test_14.txt | AC | 28 ms | 7004 KiB |
test_15.txt | AC | 26 ms | 6992 KiB |
test_16.txt | AC | 27 ms | 7020 KiB |
test_17.txt | AC | 28 ms | 6976 KiB |
test_18.txt | AC | 26 ms | 7008 KiB |
test_19.txt | AC | 27 ms | 6996 KiB |
test_20.txt | AC | 30 ms | 6976 KiB |
test_21.txt | AC | 30 ms | 7048 KiB |
test_22.txt | AC | 28 ms | 6956 KiB |