QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#112090 | #6604. Kobolds and Catacombs | zararaza# | WA | 2ms | 3440kb | C++17 | 642b | 2023-06-09 23:05:21 | 2023-06-09 23:05:25 |
Judging History
answer
#include<set>
#include<iostream>
#include<vector>
#include<map>
using namespace std;
int main() {
cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
int n; cin >> n;
vector<int> v(n), pref_max(n), suf_min(n);
for (int i = 0; i < n; i++) cin >> v[i];
for (int i = 0; i < n; i++) {
pref_max[i] = i == 0 ? v[i] : max(pref_max[i-1], v[i]);
}
for (int i = n-1; i > -1; i--) {
suf_min[i] = i == n-1 ? v[i] : min(v[i], suf_min[i+1]);
}
int res = 0;
for (int i = 0; i < n; i++) {
if (pref_max[i] <= suf_min[i+1]) res++;
}
cout << res << endl;
}
详细
Test #1:
score: 0
Wrong Answer
time: 2ms
memory: 3440kb
input:
5 1 3 2 7 4
output:
2
result:
wrong answer 1st numbers differ - expected: '3', found: '2'