Submission #1602699
Source Code Expand
//In the name of god #include <bits/stdc++.h> #define pb push_back #define F first #define S second using namespace std; typedef long long ll; typedef pair<int,int> pii; int main(){ ios_base::sync_with_stdio(0) , cin.tie(0); int x,k; cin >> x >> k; vector<int> swp; int a1; for (int i = 0;i < k;i++){ cin >> a1; swp.pb(a1); } int q; cin >> q; int t,a; for (int i = 0;i < q;i++){ cin >> t >> a; int lt = 0; int j; for ( j = 0 ;j < swp.size();j++){ if (swp[j] > t) break; int ps = swp[j] - lt; if (j % 2){ a = min(x,a + ps); }else { a = max(0,a - ps); } lt = swp[j]; } int ps = t - lt; if (j % 2){ a = min(x,a + ps); }else { a = max(0,a - ps); } cout <<a << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | F - Sandglass |
User | chaxy_2000 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 795 Byte |
Status | TLE |
Exec Time | 2103 ms |
Memory | 1280 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 700 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt, 0_002.txt |
All | 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt, 1_025.txt, 1_026.txt, 1_027.txt, 1_028.txt, 1_029.txt, 1_030.txt, 1_031.txt, 1_032.txt, 1_033.txt, 1_034.txt, 1_035.txt, 1_036.txt, 1_037.txt, 1_038.txt, 1_039.txt, 1_040.txt, 1_041.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 1 ms | 256 KB |
0_001.txt | AC | 1 ms | 256 KB |
0_002.txt | AC | 1 ms | 256 KB |
1_003.txt | TLE | 2103 ms | 892 KB |
1_004.txt | TLE | 2103 ms | 892 KB |
1_005.txt | TLE | 2103 ms | 892 KB |
1_006.txt | TLE | 2103 ms | 892 KB |
1_007.txt | TLE | 2103 ms | 892 KB |
1_008.txt | TLE | 2103 ms | 892 KB |
1_009.txt | TLE | 2103 ms | 892 KB |
1_010.txt | TLE | 2103 ms | 892 KB |
1_011.txt | TLE | 2103 ms | 892 KB |
1_012.txt | TLE | 2103 ms | 1016 KB |
1_013.txt | TLE | 2103 ms | 1016 KB |
1_014.txt | TLE | 2103 ms | 892 KB |
1_015.txt | TLE | 2103 ms | 1016 KB |
1_016.txt | TLE | 2103 ms | 1016 KB |
1_017.txt | TLE | 2103 ms | 1016 KB |
1_018.txt | TLE | 2103 ms | 1016 KB |
1_019.txt | TLE | 2103 ms | 1016 KB |
1_020.txt | TLE | 2103 ms | 1016 KB |
1_021.txt | TLE | 2103 ms | 892 KB |
1_022.txt | TLE | 2103 ms | 1144 KB |
1_023.txt | TLE | 2103 ms | 1144 KB |
1_024.txt | TLE | 2103 ms | 892 KB |
1_025.txt | TLE | 2103 ms | 1144 KB |
1_026.txt | TLE | 2103 ms | 1144 KB |
1_027.txt | TLE | 2103 ms | 892 KB |
1_028.txt | TLE | 2103 ms | 892 KB |
1_029.txt | TLE | 2103 ms | 1144 KB |
1_030.txt | TLE | 2103 ms | 892 KB |
1_031.txt | TLE | 2103 ms | 892 KB |
1_032.txt | TLE | 2103 ms | 1272 KB |
1_033.txt | AC | 171 ms | 1152 KB |
1_034.txt | AC | 255 ms | 1024 KB |
1_035.txt | TLE | 2103 ms | 1144 KB |
1_036.txt | AC | 171 ms | 1152 KB |
1_037.txt | AC | 260 ms | 1152 KB |
1_038.txt | TLE | 2103 ms | 1144 KB |
1_039.txt | AC | 172 ms | 896 KB |
1_040.txt | AC | 266 ms | 1280 KB |
1_041.txt | TLE | 2103 ms | 1272 KB |