Submission #959162

#TimeUsernameProblemLanguageResultExecution timeMemory
959162Mizo_CompilerTeams (IOI15_teams)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "teams.h" using namespace std; typedef long long ll; typedef double ld; #define pb push_back #define sz(x) int32_t(x.size()) #define all(x) x.begin(),x.end() #define F first #define S second int n; vector<pair<int, int>> v; void init(int N, int A[], int B[]) { n = N; for (int i = 0; i < n; i++) { v.pb({B[i], A[i]}); } sort(all(v)); } int can(int M, int K[]) { sort(K, K+M); int sm = 0; for (int i = 0; i < M; i++) { sm += K[i]; if (sm > n)return 0; } int id = 0, rem = K[0]; vector<bool> tk(n, false); while (id < M) { bool ff = false; for (int i = 0; i < n; i++) { if (tk[i])continue; if (v[i].S <= K[id] && v[i].F >= K[id]) { rem--; tk[i] = true; if (!rem) { id++; if (id < M)rem = K[id]; } ff = true; break; } } if (!ff)break; } return (id == M); } /*int main () { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; int a[n], b[n]; for (int i = 0; i < n; i++) { cin >> a[i] >> b[i]; } init(n, a, b); int q; cin >> q; while (q--) { int m; cin >> m; int ar[m]; for (int i = 0; i < m; i++) { cin >> ar[i]; } cout << can(m, ar); } /*int a[] = {1, 2, 2, 2}, b[] = {2, 3, 3, 4}; init(4, a, b); int c[] = {1, 3}; cout << can(2, c);*/ }*/

Compilation message (stderr)

teams.cpp:71:2: warning: "/*" within comment [-Wcomment]
   71 |  /*int a[] = {1, 2, 2, 2}, b[] = {2, 3, 3, 4};
      |   
teams.cpp:75:1: error: expected declaration before '}' token
   75 | }*/
      | ^
teams.cpp:75:3: error: expected unqualified-id before '/' token
   75 | }*/
      |   ^