# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
443814 | 2021-07-12T06:54:03 Z | impri | Palembang Bridges (APIO15_bridge) | C++14 | 128 ms | 3480 KB |
#include<bits/stdc++.h> using namespace std; int main(void){ int k,n; vector<int>arr; cin >> k >> n; long long res=0; for(int i=1;i<=n;i++){ char a,b; int c,d; cin >> a >> c >> b >> d; if(a==b)res+=abs(c-d); else{ arr.push_back(c); arr.push_back(d); } } if(arr.empty()){ cout << res; return 0; } sort(arr.begin(),arr.end()); res+=(arr.size())/2; int mid=(arr.size())/2; for(int i=0;i<arr.size();i++){ res+=abs(arr[i]-arr[mid]); } cout << res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 2 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 2 ms | 316 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 2 ms | 204 KB | Output is correct |
10 | Correct | 2 ms | 204 KB | Output is correct |
11 | Correct | 2 ms | 304 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 2 ms | 204 KB | Output is correct |
5 | Correct | 2 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 2 ms | 204 KB | Output is correct |
8 | Correct | 1 ms | 204 KB | Output is correct |
9 | Correct | 2 ms | 204 KB | Output is correct |
10 | Correct | 2 ms | 204 KB | Output is correct |
11 | Correct | 2 ms | 204 KB | Output is correct |
12 | Correct | 59 ms | 2104 KB | Output is correct |
13 | Correct | 128 ms | 3440 KB | Output is correct |
14 | Correct | 90 ms | 2544 KB | Output is correct |
15 | Correct | 73 ms | 2252 KB | Output is correct |
16 | Correct | 90 ms | 2760 KB | Output is correct |
17 | Correct | 113 ms | 3428 KB | Output is correct |
18 | Correct | 110 ms | 3124 KB | Output is correct |
19 | Correct | 122 ms | 3480 KB | Output is correct |
20 | Correct | 100 ms | 3060 KB | Output is correct |
21 | Correct | 111 ms | 3252 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 0 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 204 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 204 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Incorrect | 1 ms | 204 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |