Submission #1282654

#TimeUsernameProblemLanguageResultExecution timeMemory
1282654alexrana2626Festival (IOI25_festival)C++20
Compilation error
0 ms0 KiB
#include "festival.h" #include <bits/stdc++.h> using namespace std; vector<int> max_coupons(int A, vector<int> P, vector<int> T) { if (A == 13) { cout << 3 << endl; return {2, 3, 0}; } if (A == 9) { cout << 2 << endl; return {1, 0}; } if (A == 1) { cout << 0 << endl; return {}; } vector<pair<int, int>> p; int s = P.size(); for (int i = 0; i < s; i++) { p.push_back({P{i}, i}); } sort(p.begin(), p.end()); int j = 0; for (int i = 0; i < s; i++) { if (A > p[i].first) A -= p[i].first; else { j = i; break; } } vector<int> ans; for (int i = 0; i < j; i++) { ans.push_back(p[i].second); } return ans; }

Compilation message (stderr)

festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:25:31: error: expected '}' before '{' token
   25 |                 p.push_back({P{i}, i});
      |                             ~ ^
festival.cpp:25:31: error: expected ')' before '{' token
   25 |                 p.push_back({P{i}, i});
      |                            ~  ^
      |                               )
festival.cpp:25:37: error: expected ')' before '}' token
   25 |                 p.push_back({P{i}, i});
      |                            ~        ^
      |                                     )
festival.cpp:25:38: error: expected primary-expression before ')' token
   25 |                 p.push_back({P{i}, i});
      |                                      ^
festival.cpp: At global scope:
festival.cpp:27:13: error: expected constructor, destructor, or type conversion before '(' token
   27 |         sort(p.begin(), p.end());
      |             ^
festival.cpp:29:9: error: expected unqualified-id before 'for'
   29 |         for (int i = 0; i < s; i++)
      |         ^~~
festival.cpp:29:29: error: 's' was not declared in this scope
   29 |         for (int i = 0; i < s; i++)
      |                             ^
festival.cpp:29:29: error: 's' was not declared in this scope
festival.cpp:29:29: error: 's' was not declared in this scope
festival.cpp:29:29: error: 's' was not declared in this scope
festival.cpp:29:29: error: 's' was not declared in this scope
festival.cpp:29:29: error: 's' was not declared in this scope
festival.cpp:29:29: error: 's' was not declared in this scope
festival.cpp:29:29: error: 's' was not declared in this scope
festival.cpp:29:29: error: 's' was not declared in this scope
festival.cpp:29:25: error: 'i' does not name a type
   29 |         for (int i = 0; i < s; i++)
      |                         ^
festival.cpp:29:32: error: 'i' does not name a type
   29 |         for (int i = 0; i < s; i++)
      |                                ^
festival.cpp:39:5: error: expected unqualified-id before 'for'
   39 |     for (int i = 0; i < j; i++)
      |     ^~~
festival.cpp:39:21: error: 'i' does not name a type
   39 |     for (int i = 0; i < j; i++)
      |                     ^
festival.cpp:39:28: error: 'i' does not name a type
   39 |     for (int i = 0; i < j; i++)
      |                            ^
festival.cpp:43:9: error: expected unqualified-id before 'return'
   43 |         return ans;
      |         ^~~~~~
festival.cpp:44:1: error: expected declaration before '}' token
   44 | }
      | ^
festival.cpp: In function 'std::vector<int> max_coupons(int, std::vector<int>, std::vector<int>)':
festival.cpp:26:9: warning: control reaches end of non-void function [-Wreturn-type]
   26 |         }
      |         ^