# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
56922 | 2018-07-13T07:57:32 Z | 정원준(#1637) | None (JOI15_walls) | C++11 | 3000 ms | 4592 KB |
#include <bits/stdc++.h> #define L long long using namespace std; L s[200020],e[200020]; vector<L>attack; L at[200020]; L ans[200020]; L n,m; int main() { scanf("%lld %lld",&n,&m); L i,j; for(i=1;i<=n;i++) { scanf("%lld %lld",&s[i],&e[i]); } for(i=1;i<=m;i++) { scanf("%lld",&at[i]); } for(i=1;i<=m;i++) { if(attack.size()>0&&i<m&&(at[i]-attack[attack.size()-1])*(at[i]-at[i+1])<=0) continue; attack.push_back(at[i]); } for(i=1;i<=n;i++) { for(j=0;j<attack.size();j++) { if(attack[j]>e[i]) { L sub=attack[j]-e[i]; ans[i]+=sub; s[i]+=sub; e[i]+=sub; } if(attack[j]<s[i]) { L sub=s[i]-attack[j]; ans[i]+=sub; s[i]-=sub; e[i]-=sub; } } } for(i=1;i<=n;i++) { printf("%lld\n",ans[i]); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 504 KB | Output is correct |
2 | Correct | 49 ms | 4180 KB | Output is correct |
3 | Correct | 56 ms | 4256 KB | Output is correct |
4 | Correct | 61 ms | 4468 KB | Output is correct |
5 | Correct | 52 ms | 4468 KB | Output is correct |
6 | Correct | 51 ms | 4468 KB | Output is correct |
7 | Correct | 40 ms | 4468 KB | Output is correct |
8 | Correct | 63 ms | 4468 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1476 ms | 4468 KB | Output is correct |
2 | Execution timed out | 3067 ms | 4592 KB | Time limit exceeded |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 504 KB | Output is correct |
2 | Correct | 49 ms | 4180 KB | Output is correct |
3 | Correct | 56 ms | 4256 KB | Output is correct |
4 | Correct | 61 ms | 4468 KB | Output is correct |
5 | Correct | 52 ms | 4468 KB | Output is correct |
6 | Correct | 51 ms | 4468 KB | Output is correct |
7 | Correct | 40 ms | 4468 KB | Output is correct |
8 | Correct | 63 ms | 4468 KB | Output is correct |
9 | Correct | 1476 ms | 4468 KB | Output is correct |
10 | Execution timed out | 3067 ms | 4592 KB | Time limit exceeded |
11 | Halted | 0 ms | 0 KB | - |