QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#767057 | #4935. Exchange Bottleneck | Fireball0424# | WA | 3ms | 4384kb | C++17 | 969b | 2024-11-20 19:41:22 | 2024-11-20 19:41:28 |
Judging History
answer
// #pragma GCC optimizer("Ofast")
// #pragma GCC target("avx2")
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define ull unsigned long long
#define fr first
#define fi first
#define sc second
#define se second
#define all(x) x.begin(), x.end()
#define pii pair<int,int>
//#define sz(x) (int)x.size()
using namespace std;
#ifndef fireball
#define tofu ios::sync_with_stdio(0); cin.tie(0);
#else
#define tofu freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
void db() {cout << '\n';}
template <typename T, typename ...U> void db(T a, U ...b) {cout << a << ' ', db(b...);}
const int INF = 1ll << 60;
signed main(){
tofu;
int n; cin >> n;
int a[n - 1];
for(int i = 0; i < n - 1; ++i) cin >> a[i];
int cnt = 0;
for(int i = n - 2; i >= 0; --i){
if(a[i] == 0) cnt++;
else break;
}
if(cnt == n - 1) db(cnt);
else db(cnt + 1);
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3592kb
input:
5 1 0 1 0
output:
2
result:
ok single line: '2 '
Test #2:
score: 0
Accepted
time: 0ms
memory: 3588kb
input:
7 1 1 1 1 1 1
output:
1
result:
ok single line: '1 '
Test #3:
score: 0
Accepted
time: 0ms
memory: 3668kb
input:
2 0
output:
1
result:
ok single line: '1 '
Test #4:
score: -100
Wrong Answer
time: 3ms
memory: 4384kb
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 '