QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#750563 | #8040. Let Them Eat Cake | Eqvpkbz# | WA | 7ms | 6268kb | C++17 | 1.3kb | 2024-11-15 15:00:11 | 2024-11-15 15:00:12 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve() {
int n; cin >> n;
vector<int> a(n);
vector<int> cur(n);
for(int i = 0; i < n; ++ i) {
cin >> a[i]; cur[i] = a[i];
}
int cnt = 0;
while (1) {
// cerr << "Now cur : ";
// for(int i = 0; i < cur.size(); ++ i)
// cerr << cur[i] << " ";
// cerr << "\n";
vector<int> label; label.resize(cur.size());
label[0] = 0;
for(int i = 1; i < cur.size(); ++ i) {
label[i] = 0;
if (cur[i] > cur[i - 1]) {
label[i - 1] = 1;
} else {
label[i] = 1;
}
}
vector<int> nxt;
for(int i = 0; i < cur.size(); ++ i)
if (label[i] == 0)
nxt.push_back(i);
// cerr << "Now nxt : ";
// for(int i = 0; i < nxt.size(); ++ i)
// cerr << nxt[i] << " ";
// cerr << "\n";
if (nxt.size() <= 1) break;
cur = nxt; ++ cnt;
}
cout << cnt + 1 << "\n";
return;
}
signed main() {
ios::sync_with_stdio(false);
cout.tie(0), cin.tie(0);
int T = 1;
// cin >> T;
while(T--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3592kb
input:
5 1 2 3 4 5
output:
1
result:
ok 1 number(s): "1"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3560kb
input:
5 1 5 3 4 2
output:
2
result:
ok 1 number(s): "2"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
2 1 2
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 6ms
memory: 5644kb
input:
100000 100000 99999 99998 99997 99996 99995 99994 99993 99992 99991 99990 99989 99988 99987 99986 99985 99984 99983 99982 99981 99980 99979 99978 99977 99976 99975 99974 99973 99972 99971 99970 99969 99968 99967 99966 99965 99964 99963 99962 99961 99960 99959 99958 99957 99956 99955 99954 99953 9995...
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: -100
Wrong Answer
time: 7ms
memory: 6268kb
input:
100000 28708 58898 66379 81466 37843 38494 7200 13212 70705 98441 68380 79776 45228 18860 96220 19831 27343 59978 23624 87081 30257 26315 23862 7186 37684 193 70599 29284 14627 30319 51080 95350 17977 32253 58304 19841 67584 44345 69298 63002 48446 5959 8500 12298 59988 55130 56346 5380 23327 13969 ...
output:
2
result:
wrong answer 1st numbers differ - expected: '11', found: '2'