# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
328421 | 2020-11-16T13:15:57 Z | egas | Lightning Rod (NOI18_lightningrod) | C++14 | 2000 ms | 158672 KB |
#include <bits/stdc++.h> using namespace std; bool done[30]; int tt=0; int solve(vector<pair<int,int> > &v) { int res=INT_MAX; for(int i=0; i<v.size(); i++) { int cnt=0; vector<int> temp; for(int j=i; j<v.size(); j++) { if(!done[j] and abs(v[i].second-v[j].second)>=abs(v[i].first-v[j].first)) { done[j]=1; cnt++; temp.push_back(j); } } for(int j=i; j>=0; j--) { if(!done[j] and abs(v[i].second-v[j].second)>=abs(v[i].first-v[j].first)) { done[j]=1; temp.push_back(j); cnt++; } } if(cnt>0) { res=min(res,1+solve(v)); } for(int x:temp) { done[x]=0; } } if(res==INT_MAX)res=0; return res; } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<pair<int,int> > v; bool isSub1=true; for(int i = 0 ; i < n ; i++) { int x; cin >> x; int y; cin >> y; if(y!=1)isSub1=false; v.push_back({x,y}); } if(isSub1) { cout << n << '\n'; } else { cout << solve(v) << '\n'; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1724 ms | 131824 KB | Output is correct |
2 | Correct | 1738 ms | 131732 KB | Output is correct |
3 | Correct | 1675 ms | 131880 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 364 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 0 ms | 364 KB | Output is correct |
7 | Correct | 0 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 364 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 0 ms | 364 KB | Output is correct |
7 | Correct | 0 ms | 364 KB | Output is correct |
8 | Execution timed out | 2071 ms | 364 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 364 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 0 ms | 364 KB | Output is correct |
7 | Correct | 0 ms | 364 KB | Output is correct |
8 | Execution timed out | 2071 ms | 364 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 0 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 364 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 0 ms | 364 KB | Output is correct |
7 | Correct | 0 ms | 364 KB | Output is correct |
8 | Execution timed out | 2071 ms | 364 KB | Time limit exceeded |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1841 ms | 158672 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1724 ms | 131824 KB | Output is correct |
2 | Correct | 1738 ms | 131732 KB | Output is correct |
3 | Correct | 1675 ms | 131880 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 0 ms | 364 KB | Output is correct |
6 | Correct | 0 ms | 364 KB | Output is correct |
7 | Correct | 0 ms | 364 KB | Output is correct |
8 | Correct | 0 ms | 364 KB | Output is correct |
9 | Correct | 0 ms | 364 KB | Output is correct |
10 | Correct | 0 ms | 364 KB | Output is correct |
11 | Execution timed out | 2071 ms | 364 KB | Time limit exceeded |
12 | Halted | 0 ms | 0 KB | - |