QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#203876#4935. Exchange Bottlenecktriplem5ds#WA 1ms3496kbC++231.1kb2023-10-06 21:25:422023-10-06 21:25:42

Judging History

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

  • [2023-10-06 21:25:42]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3496kb
  • [2023-10-06 21:25:42]
  • 提交

answer

/// Msaa el 5ra
#pragma GCC optimize("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx,avx2,fma")

#include "bits/stdc++.h"

using namespace std;

#define pb push_back
#define F first
#define S second
#define f(i, a, b)  for(int i = a; i < b; i++)
#define all(a)  a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) (int)(x).size()
#define mp(x, y) make_pair(x,y)
#define popCnt(x) (__builtin_popcountll(x))
#define int ll

using ll = long long;
using ii = pair<int, int>;
using ull = unsigned long long;

const int N = 1e5 + 5, LG = 18, MOD = 1e9 + 7;
const long double PI = acos(-1);
const long double EPS = 1e-7;


void doWork() {
    int n;
    cin >> n;
    vector<int> a(n + 1, 1);
    f(i, 2, n + 1) cin >> a[i];
    int ans = 1;
    while (!a[n])--n, ++ans;
    for (int i = 2; i <= n; i++)if (!a[i])ans = max(ans, 2ll);
    cout << ans << '\n';
}

int32_t main() {
#ifdef ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif // ONLINE_JUDGE

    int t = 1;
//    cin >> t;
    while (t--) {
        doWork();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3496kb

input:

5
1 0 1 0

output:

2

result:

ok single line: '2'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3416kb

input:

7
1 1 1 1 1 1

output:

1

result:

ok single line: '1'

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3460kb

input:

2
0

output:

2

result:

wrong answer 1st lines differ - expected: '1', found: '2'