Submission #783355

#TimeUsernameProblemLanguageResultExecution timeMemory
783355MatblubeTeams (IOI15_teams)C++14
Compilation error
0 ms0 KiB
#include "teams.h"
#include <iostream>
#include <iomanip>
#include <string>
#include <math.h>
#include <algorithm>
#include <cstring>
#include <numeric>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <unordered_map>
#include <unordered_set>
using namespace std;
typedef long long ll;
#define dbg(x) cerr<<#x<<": "<<x<<"\n";
#define fr(i, x) for(ll i=0 ; i<x ; i++)
#define fra(x, v) for(auto x:v)
#define fra1(x,v) for(auto &x:v)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define pb(x) push_back(x)
#define F first
#define S second

const ll maxN=5e6;
pair<ll, ll> vp[maxN];
bool uwu[maxN];

void init(int N, int A[], int B[]) {
    fr(i, N){
        vp[i].F=A[i];
        vp[i].S=B[i];
    }
    sort(vp, vp+n);
}

int can(int M, int K[]) {
    sort(k, k+m);
    ll cc=0;
    fill(uwu, uwu+maxN, 0);
    fr(i, m){
        cc=0;
        fr(j, n){
            if(cc>=K[i]) break;
            if(uwu[j] || vp[j][0]<K[i] || vp[j][1]>K[i]) continue;
            cc++;
            uwu[j]=1;
        }
        if(cc!=K[i]) return 0;
    }
	return 1;
}

Compilation message (stderr)

teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:36:17: error: 'n' was not declared in this scope
   36 |     sort(vp, vp+n);
      |                 ^
teams.cpp: In function 'int can(int, int*)':
teams.cpp:40:10: error: 'k' was not declared in this scope
   40 |     sort(k, k+m);
      |          ^
teams.cpp:40:15: error: 'm' was not declared in this scope
   40 |     sort(k, k+m);
      |               ^
teams.cpp:45:15: error: 'n' was not declared in this scope
   45 |         fr(j, n){
      |               ^
teams.cpp:18:33: note: in definition of macro 'fr'
   18 | #define fr(i, x) for(ll i=0 ; i<x ; i++)
      |                                 ^
teams.cpp:47:31: error: no match for 'operator[]' (operand types are 'std::pair<long long int, long long int>' and 'int')
   47 |             if(uwu[j] || vp[j][0]<K[i] || vp[j][1]>K[i]) continue;
      |                               ^
teams.cpp:47:48: error: no match for 'operator[]' (operand types are 'std::pair<long long int, long long int>' and 'int')
   47 |             if(uwu[j] || vp[j][0]<K[i] || vp[j][1]>K[i]) continue;
      |                                                ^
teams.cpp:39:13: warning: unused parameter 'M' [-Wunused-parameter]
   39 | int can(int M, int K[]) {
      |         ~~~~^