제출 #1260595

#제출 시각아이디문제언어결과실행 시간메모리
1260595robijoy선물 (IOI25_souvenirs)C++20
컴파일 에러
0 ms0 KiB
/* * Starting with the name of almighty ALLAH */ #include "souvenirs.h" #include <bits/stdc++.h> using namespace std; // namespace { // const int CALLS_CNT_LIMIT = 10000; // int calls_cnt; // int N = 3; // std::vector<long long> P = {11,7,3}; // std::vector<int> Q = {0,0,0}; // void quit(const char* message) { // printf("%s\n", message); // exit(0); // } // } // namespace // std::pair<std::vector<int>, long long> transaction(long long M) { // calls_cnt++; // if (calls_cnt > CALLS_CNT_LIMIT) // quit("Too many calls"); // if (M >= P[0] || M < P[N - 1]) // quit("Invalid argument"); // std::vector<int> L; // long long R = M; // for (int i = 0; i < N; i++) { // if (R >= P[i]) { // R -= P[i]; // Q[i]++; // L.push_back(i); // } // } // return {L, R}; // } void buy_souvenirs(int N, long long P0) { pair<vector<int>,long long> res = transaction(P0-1); vector<int> robi = res.first; int ret = res.second; if(robi.size() == 1) { int P1 = (P0 - 1) - ret; transaction(P1-1); transaction(P1-1); } else { transaction((P0-1-ret)/2 - 1); } } // int main() { // buy_souvenirs(3,11); // }/* * Starting with the name of almighty ALLAH */ #include "souvenirs.h" #include <bits/stdc++.h> using namespace std; // namespace { // const int CALLS_CNT_LIMIT = 10000; // int calls_cnt; // int N = 3; // std::vector<long long> P = {11,7,3}; // std::vector<int> Q = {0,0,0}; // void quit(const char* message) { // printf("%s\n", message); // exit(0); // } // } // namespace // std::pair<std::vector<int>, long long> transaction(long long M) { // calls_cnt++; // if (calls_cnt > CALLS_CNT_LIMIT) // quit("Too many calls"); // if (M >= P[0] || M < P[N - 1]) // quit("Invalid argument"); // std::vector<int> L; // long long R = M; // for (int i = 0; i < N; i++) { // if (R >= P[i]) { // R -= P[i]; // Q[i]++; // L.push_back(i); // } // } // return {L, R}; // } void buy_souvenirs(int N, long long P0) { pair<vector<int>,long long> res = transaction(P0-1); vector<int> robi = res.first; int ret = res.second; if(robi.size() == 1) { int P1 = (P0 - 1) - ret; transaction(P1-1); transaction(P1-1); } else { transaction((P0-1-ret)/2 - 1); } } // int main() { // buy_souvenirs(3,11); // }

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

souvenirs.cpp:58:15: error: expected constructor, destructor, or type conversion before 'with'
   58 |  *   Starting with the name of almighty ALLAH
      |               ^~~~
souvenirs.cpp:98:6: error: redefinition of 'void buy_souvenirs(int, long long int)'
   98 | void buy_souvenirs(int N, long long P0) {
      |      ^~~~~~~~~~~~~
souvenirs.cpp:42:6: note: 'void buy_souvenirs(int, long long int)' previously defined here
   42 | void buy_souvenirs(int N, long long P0) {
      |      ^~~~~~~~~~~~~