제출 #1260597

#제출 시각아이디문제언어결과실행 시간메모리
1260597robijoy선물 (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,1}; // 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 { int x = max(1LL,((((P0-1)-ret)/2))); cout<<x<<endl; pair<vector<int>,long long> rex = transaction(x); } } // int main() { // buy_souvenirs(3,11); // }

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

souvenirs.cpp: In function 'void buy_souvenirs(int, long long int)':
souvenirs.cpp:52:7: error: 'cout' was not declared in this scope
   52 |       cout<<x<<endl;
      |       ^~~~
souvenirs.cpp:5:1: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
    4 | #include "souvenirs.h"
  +++ |+#include <iostream>
    5 | // #include <bits/stdc++.h>
souvenirs.cpp:52:16: error: 'endl' was not declared in this scope
   52 |       cout<<x<<endl;
      |                ^~~~
souvenirs.cpp:5:1: note: 'std::endl' is defined in header '<ostream>'; did you forget to '#include <ostream>'?
    4 | #include "souvenirs.h"
  +++ |+#include <ostream>
    5 | // #include <bits/stdc++.h>