# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
173058 | 2020-01-03T09:27:48 Z | beksultan04 | K개의 묶음 (IZhO14_blocks) | C++14 | 13 ms | 632 KB |
#include <bits/stdc++.h> using namespace std; #define fr first #define sc second #define pb push_back #define mk make_pair #define OK puts("OK"); #define sz(s) (int)s.size() #define pii pair<int,int> #define int long long #define all(s) s.begin(), s.end() #define allr(s) s.rbegin(), s.rend() #define rep(i,n) for (i=0;i<(n);++i) #define rep1(i,n) for (i=1;i<=(n);++i) #define ret return #define nemeshay ios::sync_with_stdio(0),cin.tie(0); const int N=1e6+12,INF=1e9+7; int q[N]; main(){ int n,i,j,mx=0,k,ans=0; cin>>n>>k; rep(i,n)cin>>q[i]; int l=0,r=n-1; while (k>1){ if (q[l]>q[r]){ l++; ans+=l; } else { r++; ans+=q[r]; } } for (i=l;i<=r;++i){ mx=max(mx,q[i]); } cout <<ans+mx; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Runtime error | 7 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Correct | 2 ms | 376 KB | Output is correct |
4 | Runtime error | 7 ms | 504 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 7 ms | 476 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 13 ms | 632 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |