제출 #1285523

#제출 시각아이디문제언어결과실행 시간메모리
1285523alexrana2626Souvenirs (IOI25_souvenirs)C++20
컴파일 에러
0 ms0 KiB
#include "souvenirs.h" #include <utility> #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; } else if (N == 3) { auto res1 = transaction(P0 - 1); long long x = res1.second; if (res1[2].second == 0) { transaction(P0 - x - 2); transaction(P0 - x - 2); } else { transaction((P0 - x - 1)/2); } } }

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

souvenirs.cpp: In function 'void buy_souvenirs(int, long long int)':
souvenirs.cpp:18:17: error: no match for 'operator[]' (operand types are 'std::pair<std::vector<int>, long long int>' and 'int')
   18 |         if (res1[2].second == 0)
      |                 ^