# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
550924 | 2022-04-19T11:47:00 Z | AKiko | Lightning Rod (NOI18_lightningrod) | C++14 | 1567 ms | 99916 KB |
#include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define ss second #define ff first #define pb push_back #define pii pair<int, int> #define INF INT_MAX using namespace std; void debug_out() { cerr << endl; } template<typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << ' ' << H; debug_out(T...); } #ifdef AKIKO_DEBUG #define debug(...) cerr << "\033[1;31m(" << #__VA_ARGS__ << "):\033[0m", debug_out(__VA_ARGS__) #else #define debug(...) #endif #define FAST ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); const ll MOD = 1e9 + 7; int main() { FAST int n, ind = 0, mx = 0; cin >> n; stack<int> s; for(int i = 0; i < n; i++) { int x, y; cin >> x >> y; if(mx >= x + y) { continue; } mx = x + y; int d = y - x; while(s.size() > 0 && s.top() <= d) { s.pop(); } s.push(d); } cout << s.size() << "\n"; return 0; } /* stuff you should look for * int overflow, array bounds * special cases (n=1?) * do smth instead of nothing and stay organized * WRITE STUFF DOWN * DON'T GET STUCK ON ONE APPROACH */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1408 ms | 40132 KB | Output is correct |
2 | Correct | 1340 ms | 39896 KB | Output is correct |
3 | Correct | 1332 ms | 38852 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Incorrect | 0 ms | 212 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1408 ms | 25884 KB | Output is correct |
2 | Correct | 1567 ms | 99916 KB | Output is correct |
3 | Correct | 1472 ms | 98184 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1408 ms | 40132 KB | Output is correct |
2 | Correct | 1340 ms | 39896 KB | Output is correct |
3 | Correct | 1332 ms | 38852 KB | Output is correct |
4 | Correct | 0 ms | 212 KB | Output is correct |
5 | Correct | 0 ms | 212 KB | Output is correct |
6 | Correct | 0 ms | 212 KB | Output is correct |
7 | Incorrect | 0 ms | 212 KB | Output isn't correct |
8 | Halted | 0 ms | 0 KB | - |