Submission #61815612
Source Code Expand
Copy
#include <iostream>#include <vector>using namespace std;vector<pair<int,int>> query;void operation_1(vector<pair<int,int>> &a, int length){if(a.size() == 0){a.push_back({0,length});}else{a.push_back({a[(int)a.size()-1].first + a[(int)a.size()-1].second, length});}}void operation_2(vector<pair<int,int>> &a){int length = a[0].second;a.erase(a.begin());for(int i = 0; i < (int)a.size(); i++){a[i].first -= length;}}void operation_3(vector<pair<int,int>> &a, int length){cout << a[length-1].first << endl;
#include <iostream> #include <vector> using namespace std; vector<pair<int,int>> query; void operation_1(vector<pair<int,int>> &a, int length){ if(a.size() == 0){ a.push_back({0,length}); } else{ a.push_back({a[(int)a.size()-1].first + a[(int)a.size()-1].second, length}); } } void operation_2(vector<pair<int,int>> &a){ int length = a[0].second; a.erase(a.begin()); for(int i = 0; i < (int)a.size(); i++){ a[i].first -= length; } } void operation_3(vector<pair<int,int>> &a, int length){ cout << a[length-1].first << endl; } int main(){ int q,querytype,length; cin >> q; for (int i = 0; i < q; i++){ cin >> querytype; if (querytype == 1){ cin >> length; operation_1(query, length); } if (querytype == 2){ operation_2(query); } if (querytype == 3){ cin >> length; operation_3(query, length); } } }
Submission Info
Submission Time | |
---|---|
Task | C - Snake Queue |
User | g0at6996 |
Language | C++ 20 (gcc 12.2) |
Score | 0 |
Code Size | 1028 Byte |
Status | WA |
Exec Time | 2210 ms |
Memory | 7348 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt, 01_test_20.txt, 01_test_21.txt, 01_test_22.txt, 01_test_23.txt, 01_test_24.txt, 01_test_25.txt, 01_test_26.txt, 01_test_27.txt, 02_min_00.txt, 02_min_01.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 1 ms | 3448 KB |
00_sample_01.txt | AC | 1 ms | 3504 KB |
00_sample_02.txt | AC | 1 ms | 3436 KB |
01_test_00.txt | WA | 1 ms | 3496 KB |
01_test_01.txt | WA | 2 ms | 3456 KB |
01_test_02.txt | WA | 5 ms | 3516 KB |
01_test_03.txt | WA | 5 ms | 3516 KB |
01_test_04.txt | WA | 1 ms | 3568 KB |
01_test_05.txt | WA | 6 ms | 3460 KB |
01_test_06.txt | TLE | 2208 ms | 4116 KB |
01_test_07.txt | WA | 654 ms | 3764 KB |
01_test_08.txt | TLE | 2208 ms | 4164 KB |
01_test_09.txt | WA | 1974 ms | 3856 KB |
01_test_10.txt | TLE | 2208 ms | 4108 KB |
01_test_11.txt | WA | 472 ms | 3568 KB |
01_test_12.txt | TLE | 2210 ms | 4072 KB |
01_test_13.txt | WA | 418 ms | 3560 KB |
01_test_14.txt | TLE | 2208 ms | 4160 KB |
01_test_15.txt | TLE | 2207 ms | 4144 KB |
01_test_16.txt | TLE | 2208 ms | 4104 KB |
01_test_17.txt | TLE | 2207 ms | 4148 KB |
01_test_18.txt | TLE | 2208 ms | 5348 KB |
01_test_19.txt | TLE | 2208 ms | 5140 KB |
01_test_20.txt | TLE | 2207 ms | 5152 KB |
01_test_21.txt | TLE | 2208 ms | 5352 KB |
01_test_22.txt | WA | 243 ms | 5148 KB |
01_test_23.txt | WA | 244 ms | 5124 KB |
01_test_24.txt | AC | 108 ms | 7292 KB |
01_test_25.txt | AC | 53 ms | 7348 KB |
01_test_26.txt | AC | 101 ms | 7232 KB |
01_test_27.txt | AC | 66 ms | 3484 KB |
02_min_00.txt | AC | 1 ms | 3444 KB |
02_min_01.txt | AC | 1 ms | 3468 KB |