# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
314431 | 2020-10-19T20:56:38 Z | urosk | Colouring a rectangle (eJOI19_colouring) | C++14 | 361 ms | 2296 KB |
#include <bits/stdc++.h> #include <chrono> #define ll long long #define ull unsigned long long #define ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define inf 1e15 #define pb push_back #define popb pop_back #define fi first #define sc second using namespace std; using namespace std::chrono; /*auto start = high_resolution_clock::now(); auto stop = high_resolution_clock::now(); auto duration = duration_cast<microseconds>(stop - start); cout << "Time taken by function: " << duration.count() << " microseconds" << endl;*/ const int maxn = 2e5+5; int a[maxn]; int b[maxn]; int main(){ int n,m; cin >> n >> m; for(int i = 0;i<n+m-1;i++){ cin >> a[i]; } for(int i = 0;i<n+m-1;i++){ cin >> b[i]; } if(n!=1){ ll ans1 = 0; ll ans2 = 0; ll ans = 0; for(int i = 1;i<n+m-1;i+=2){ ans1+=a[i]; } for(int i = 0;i<n+m-1;i+=2){ ans2+=b[i]; } ans+=min(ans2,ans1); ans1 = 0; ans2 = 0; for(int i = 0;i<n+m-1;i+=2){ ans1+=a[i]; } for(int i = 1;i<n+m-1;i+=2){ ans2+=b[i]; } ans+=min(ans1,ans2); cout<<ans; }else if(n==1){ ll ans = 0; for(int i = 0;i<m+n-1;i++){ ans+=min(a[i],b[m+n-i-2]); } cout<<ans; }else{ cout<<0; } } /*1 5 3 2 3 5 7 1 3 5 2 4*/
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Incorrect | 0 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Incorrect | 0 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Incorrect | 0 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Incorrect | 0 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 331 ms | 2064 KB | Output is correct |
2 | Correct | 328 ms | 1912 KB | Output is correct |
3 | Correct | 342 ms | 1912 KB | Output is correct |
4 | Correct | 344 ms | 2040 KB | Output is correct |
5 | Correct | 361 ms | 1876 KB | Output is correct |
6 | Correct | 288 ms | 1912 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 182 ms | 2296 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 | 0 ms | 256 KB | Output is correct |
2 | Incorrect | 0 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |