QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#463102#8770. Comparatorstd_abs#WA 0ms4488kbC++20640b2024-07-04 13:49:462024-07-04 13:49:47

Judging History

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

  • [2024-07-04 13:49:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4488kb
  • [2024-07-04 13:49:46]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define pii pair<int, int>
#define all(a) a.begin(), a.end()
#define sz(a) ((int)a.size())
const int mod = 998244353, N = 100005;

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    int n;
    ll p, c[N];
    cin >> n >> p;
    for (int i = 0; i < n; ++i)
        cin >> c[i];
    for (int i = 0; i < n; ++i) {
        ll tmp = p / (i + 1);
        if (tmp >= c[i] || (tmp == c[i] - 1 && p % (i + 1) != 0))
            p -= c[i];
        else
            return cout << i << '\n', 0;
    }
    cout << n << '\n';
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 4488kb

input:

3 2
1 1 (x=0)&(y=1) 1
1 1 (x=1)&(y=(x^x)) 0
2 2 (x=1)|(y=0) 0
1

output:

3

result:

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