This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "teams.h"
#include<bits/stdc++.h>
using namespace std;
#define sz(v) ((int)(v).size())
typedef long long lint;
typedef pair<int,int> pii;
int n;
pii d[500003];
void init(int N, int A[], int B[]) {
n=N;
for(int i=0;i<n;i++)d[i]={A[i],B[i]};
sort(d,d+n);
}
int can(int M, int K[]) {
lint sum=0;
for(int i=0;i<M;i++)sum+=K[i];
if(sum>n)return 0;
int ans=1,t;
sort(K,K+M);
t=K[0];
vector<pii>V;
for(int i=1;i<M;i++)
{
if(K[i]==K[i-1])
{
t+=K[i];
}
else
{
V.push_back({K[i-1],t});
t=K[i];
}
}
V.push_back({K[M-1],t});
int m=sz(V);
return ans;
}
Compilation message (stderr)
teams.cpp: In function 'int can(int, int*)':
teams.cpp:39:6: warning: unused variable 'm' [-Wunused-variable]
39 | int m=sz(V);
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |