Submission #802305

#TimeUsernameProblemLanguageResultExecution timeMemory
802305KhizriTeams (IOI15_teams)C++17
0 / 100
4043 ms11468 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back #define F first #define S second #define INF 1e18 #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define pii pair<int,int> #define pll pair<ll,ll> #define OK cout<<"Ok"<<endl; #define MOD (ll)(1e9+7) const int mxn=2e5+5; int n,x[mxn],y[mxn]; void init(int N, int A[], int B[]) { n=N; for(int i=0;i<n;i++){ x[i+1]=A[i]; y[i+1]=B[i]; } } bool cmp(pii a,pii b){ if(a.S==b.S){ return a.F>b.F; } return a.S<b.S; } int can(int m, int arr[]) { sort(arr+1,arr+m+1); vector<pii>vt; for(int i=1;i<=n;i++){ vt.pb({x[i],y[i]}); } ll sum=0; for(int i=0;i<m;i++){ sum+=arr[i]; } if(sum>n) return 0; sort(all(vt),cmp); for(int i=0;i<m;i++){ int cnt=arr[i]; for(int j=0;j<vt.size();j++){ if(!cnt) break; if(vt[j].F<=arr[i]&&vt[j].S>=arr[i]){ vt.erase(vt.begin()+j); j--; cnt--; } } if(cnt) return 0; } return 1; } /* g++ teams.cpp grader.cpp ; .\a.exe */

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:44:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         for(int j=0;j<vt.size();j++){
      |                     ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...