# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
451987 | 2021-08-03T15:35:08 Z | PiejanVDC | Knjige (COCI20_knjige) | C++17 | 1 ms | 424 KB |
#include <bits/stdc++.h> using namespace std; signed main() { int n; cin>>n; vector<int>sorted(n); stack<int>l,r; for(int i = 0 ; i < n ; i++) { cin>>sorted[i]; l.push(sorted[i]); } // rechts ==> nemen // links ==> vasthouden sort(sorted.rbegin(),sorted.rend()); bool f = true; for(int i = 0 ; i < n ; i++) { int t = sorted[i]; if(f) { for(int j = 0 ; j < n - i ; j++) { if(l.top() != t) r.push(l.top()), cout << "UZMI D L\nSTAVI D D\n"; else cout << "UZMI L L\n"; l.pop(); } cout << "STAVI L L\n"; l.push(t); f=false; } else { while(true) { if(r.top() == t) break; cout << "UZMI D D\nSTAVI D L\n"; l.push(r.top()); r.pop(); } cout << "UZMI L D\n"; r.pop(); while(l.size() > i) { r.push(l.top()); l.pop(); cout << "UZMI D L\nSTAVI D D\n"; } l.push(t); cout << "STAVI L L\n"; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 332 KB | Execution killed with signal 11 |
2 | Runtime error | 1 ms | 332 KB | Execution killed with signal 11 |
3 | Runtime error | 1 ms | 424 KB | Execution killed with signal 11 |
4 | Incorrect | 1 ms | 332 KB | Expected integer, but "UZMI" found |
5 | Incorrect | 1 ms | 332 KB | Expected integer, but "UZMI" found |
6 | Runtime error | 1 ms | 332 KB | Execution killed with signal 11 |
7 | Runtime error | 1 ms | 332 KB | Execution killed with signal 11 |
8 | Incorrect | 1 ms | 332 KB | Expected integer, but "UZMI" found |
9 | Incorrect | 1 ms | 332 KB | Expected integer, but "UZMI" found |
10 | Incorrect | 1 ms | 288 KB | Expected integer, but "UZMI" found |