제출 #1252725

#제출 시각아이디문제언어결과실행 시간메모리
1252725nickolasarapidis선물 (IOI25_souvenirs)C++20
컴파일 에러
0 ms0 KiB
#include "souvenirs.h"
#include <bits/stdc++.h>
using namespace std;

#define F first
#define S second

void buy_souvenirs(int N, long long P0){
    pair<vector<int>, long long> a;
    vector<int> cnt(N, 0);
    if(N == 2){
        a = transaction(P0 - 1);
        return;
    }
    for(int i = 1; i < N; i++){
        if(cnt[i] == i) continue;
        a = transaction(P0 - 1);
        cnt[i]++;
        if(a.S == 1) P0 -= 2;
{       else{
            if(a.F.size() == 1){
                P0--;
            }
            else{
                cnt[i + 1]++;
                P0 -= 2;
            }
        }
        for(int j = cnt[i]; j < i; j++){
            a = transaction(P0);
        }
    }
}

컴파일 시 표준 에러 (stderr) 메시지

souvenirs.cpp: In function 'void buy_souvenirs(int, long long int)':
souvenirs.cpp:20:9: error: 'else' without a previous 'if'
   20 | {       else{
      |         ^~~~
souvenirs.cpp:33:2: error: expected '}' at end of input
   33 | }
      |  ^
souvenirs.cpp:8:40: note: to match this '{'
    8 | void buy_souvenirs(int N, long long P0){
      |                                        ^