답안 #1105646

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1105646 2024-10-27T07:51:08 Z KDM_Dvali 나일강 (IOI24_nile) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
vector<ll> calculate_costs(vector<int> W, vector<int> A, vector<int> B, vector<int> E) {
    int n = W.size();
    int q = E.size();
    vector<ll> result(q);
    ll total_sum = 0;
 
    for (int i = 0; i < n; i++) {
        total_sum += A[i];
    }
    
 
    for (int i = 0; i < q; i++) {
        ll D = E[i];
        ll current_sum = total_sum;
        
 
        for (int j = 0; j < n - 1; j++) {
            if (1 <= D) {  
                current_sum += (B[j] - A[j]);
            }
        }
        
        result[i] = current_sum;
    }
    
    return result;
}
 
int main() {
    int n, q;
    cin >> n >> q;
    
    vector<int> W(n), A(n), B(n), E(q);
    
    for(int i = 0; i < n; i++) {
        W[i] = i + 1;
        cin >> A[i] >> B[i];
    }
    
    for(int i = 0; i < q; i++) {
        cin >> E[i];
    }
    
    vector<ll> result = calculate_costs(W, A, B, E);
    
    for(ll x : result) {
        cout << x << " ";
    }
    cout << endl;
    
    return 0;
}

Compilation message

/usr/bin/ld: /tmp/ccbOyY6I.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccDS6pxF.o:nile.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status