QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#329297 | #4935. Exchange Bottleneck | ouo# | WA | 5ms | 33132kb | C++17 | 611b | 2024-02-16 15:49:55 | 2024-02-16 15:49:55 |
Judging History
answer
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
int n;
int arr[1000005];
int dp[1000005] = {0};
vector<int> gh[1000005];
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>>
pq;
int ans;
const int N = 1e6 + 5;
signed main() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> n;
dp[2] = 1;
for (int i = 2; i <= n; i++) {
cin >> arr[i];
if (arr[i]) {
dp[i] = 1;
} else {
dp[i] = max(dp[i - 1] + 1, dp[i]);
}
}
cout << dp[n];
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 30984kb
input:
5 1 0 1 0
output:
2
result:
ok single line: '2'
Test #2:
score: 0
Accepted
time: 5ms
memory: 30280kb
input:
7 1 1 1 1 1 1
output:
1
result:
ok single line: '1'
Test #3:
score: 0
Accepted
time: 5ms
memory: 31116kb
input:
2 0
output:
1
result:
ok single line: '1'
Test #4:
score: -100
Wrong Answer
time: 3ms
memory: 33132kb
input:
90580 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 ...
output:
1
result:
wrong answer 1st lines differ - expected: '2', found: '1'