# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
169071 | 2019-12-18T09:49:50 Z | abil | Hedgehog Daniyar and Algorithms (IZhO19_sortbooks) | C++14 | 3000 ms | 8200 KB |
#include <bits/stdc++.h> #define fr first #define sc second #define pb push_back #define mk make_pair #define all(s) s.begin(),s.end() //#define int long long using namespace std; const int N = (1e6 + 12); const int mod = (1e9 + 7); const int INF = (0x3f3f3f3f); int a[N], b[N]; main() { int n, m; scanf("%d%d", &n, &m); for(int i = 1;i <= n; i++){ scanf("%d", &a[i]); b[i] = a[i]; } int l, r, mood; while(m--){ scanf("%d%d%d", &l, &r, &mood); int ok = 1, pos = l; while(1){ int mn = INF, posofval; for(int i = pos;i <= r; i++){ if(a[i] < mn){ mn = a[i]; posofval = i; } } for(int i = posofval;i > pos; i--){ if(a[i] + a[i - 1] > mood){ ok = 0; break; } else{ swap(a[i], a[i - 1]); } } pos++; if(!ok || pos == r){ break; } } for(int i = l;i <= r; i++){ a[i] = b[i]; } printf("%d\n", ok); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Runtime error | 2831 ms | 372 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Runtime error | 2831 ms | 372 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3052 ms | 8200 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3049 ms | 1144 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Runtime error | 2831 ms | 372 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Runtime error | 2831 ms | 372 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
3 | Halted | 0 ms | 0 KB | - |