# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
314532 | 2020-10-20T08:38:45 Z | urosk | Colouring a rectangle (eJOI19_colouring) | C++14 | 2000 ms | 11316 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 = 2e6+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 zbir; ll ans = 0; vector<int> v;; int g = (n+m-1)/2; for(int i = 0;i<=g;i++){ zbir = 0; for(int j = g-i;j<=g+i;j+=2){ zbir+=b[j]; } v.pb(zbir); } for(int i = 0;i<v.size()/2;i++) v.pb(v[i]); for(int i = 0;i<n+m;i++){ ans+=min(a[i],v[i]); } 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; } } /*3 3 1 2 3 4 5 0 1 2 3 4*/
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 0 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 0 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 0 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 0 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 342 ms | 2552 KB | Output is correct |
2 | Correct | 334 ms | 2168 KB | Output is correct |
3 | Correct | 335 ms | 2168 KB | Output is correct |
4 | Correct | 355 ms | 2264 KB | Output is correct |
5 | Correct | 362 ms | 2296 KB | Output is correct |
6 | Correct | 292 ms | 2168 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2011 ms | 11316 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 384 KB | Output is correct |
2 | Incorrect | 0 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |