QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#767057#4935. Exchange BottleneckFireball0424#WA 3ms4384kbC++17969b2024-11-20 19:41:222024-11-20 19:41:28

Judging History

你现在查看的是最新测评结果

  • [2024-11-20 19:41:28]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:4384kb
  • [2024-11-20 19:41:22]
  • 提交

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);
}

详细

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 '