Submission #1288624

#TimeUsernameProblemLanguageResultExecution timeMemory
1288624alexrana2626선물 (IOI25_souvenirs)C++20
Compilation error
0 ms0 KiB
#include "souvenirs.h"
#include <bits/stdc++.h>
using namespace std;

void buy_souvenirs(int N, long long P0) 
{
    pair<vector<int>, long long> res;
    
    if (N == 2)
    {
        transaction(P0 - 1);
        return;
    }

    if (N == 3)
    {
        res = transaction(P0 - 1);
        long long x = res.second;
        if (res.first.size() == 2)
        {
            transaction((P0 - x - 1) / 2);
            return;
        }
        else
        {
            long long P1 = P0 - x - 1;
            transaction(P1 - 1);
            transaction(P1 - 1);
            return;
        }
    }

    if (P0 == N)
    {
        for (int i = 0; i < N; i++)
        {
            int j = i;
            while (j--)
            {
                transaction(N - i);
            }
        }
        return;
    }
    else
    {
        long long sm = n - 2;
        for (int i = 1; i < n; i++)
        {
            long long cnt = i - 1;
            if (i == n-1)
            {
                cnt=sm;
            }
            res = transaction(P0-1);
            long long x = res.second;            
            if (res.first.size() == 2){sm--;x++;}
            long long P = P0 - 1- tt;
            P0 = P;
            for (int j = 0; j < cnt; j++)
            {
                transaction(P);    
            }
        }
        return;
    }
}

Compilation message (stderr)

souvenirs.cpp: In function 'void buy_souvenirs(int, long long int)':
souvenirs.cpp:47:24: error: 'n' was not declared in this scope
   47 |         long long sm = n - 2;
      |                        ^
souvenirs.cpp:58:35: error: 'tt' was not declared in this scope; did you mean 'tm'?
   58 |             long long P = P0 - 1- tt;
      |                                   ^~
      |                                   tm