답안 #1099767

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1099767 2024-10-12T05:13:21 Z model_code 나일강 (IOI24_nile) C++17
17 / 100
2000 ms 4956 KB
// incorrect/hazem_A2B1_qn.cpp

#include "bits/stdc++.h"
#include "nile.h"
using namespace std;

vector<long long> calculate_costs(vector<int> W, vector<int> A, vector<int> B, vector<int> E) {
    int n = W.size();
    int q = E.size();

    vector<int> ordW(n);
    iota(ordW.begin() ,ordW.end() ,0);
    sort(ordW.begin() ,ordW.end() ,[&](int i ,int j){
        return W[i] < W[j];
    });
    vector<int> w(n);
    for(int i = 0; i < n; i++)
        w[i] = W[ordW[i]];

    auto solve = [&](int d){
        long long tot = 0;
        for(int j = 0, i = 0; i < n; i++){
            if(i+1 == n || w[i+1] - w[i] > d){
                tot += (i - j + 1) % 2;
                j = i + 1;
            }
        }
        return tot;
    };

    vector<long long> R(q, n);
    for(int i = 0; i < q; i++)
        R[i] += solve(E[i]);
    return R;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 20 ms 3416 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 3420 KB Output is correct
2 Correct 34 ms 3420 KB Output is correct
3 Correct 26 ms 3440 KB Output is correct
4 Correct 26 ms 3408 KB Output is correct
5 Correct 25 ms 3420 KB Output is correct
6 Correct 26 ms 3408 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 3420 KB Output is correct
2 Correct 34 ms 3420 KB Output is correct
3 Correct 26 ms 3440 KB Output is correct
4 Correct 26 ms 3408 KB Output is correct
5 Correct 25 ms 3420 KB Output is correct
6 Correct 26 ms 3408 KB Output is correct
7 Execution timed out 2069 ms 4956 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -