Submission #946229

#TimeUsernameProblemLanguageResultExecution timeMemory
946229Nika533Teams (IOI15_teams)C++14
34 / 100
4049 ms65228 KiB
#pragma GCC diagnostic warning "-std=c++11" #include <bits/stdc++.h> #include "teams.h" #define pb push_back #define f first #define s second #define MOD 1000000007 #define flush fflush(stdout) #define all(x) (x).begin(),(x).end() #define allr(x) (x).rbegin(), (x).rend() #define pii pair<int,int> using namespace std; const int N=5e5+5; int n,m,T,k,a[N],b[N]; vector<pii> va[N],vb[N]; void init(int N, int A[], int B[]) { n=N; for (int i=1; i<=n; i++) { a[i]=A[i-1]; b[i]=B[i-1]; va[a[i]].pb({b[i],i}); vb[b[i]].pb({b[i],i}); } } int can(int M, int K[]) { vector<int> vk(n+1,0); for (int i=0; i<M; i++) vk[K[i]]+=K[i]; set<pii> myset; for (int i=1; i<=n; i++) { for (auto x:va[i]) { myset.insert(x); } if (myset.size()<vk[i]) return 0; while (vk[i]--) { myset.erase(myset.begin()); } for (auto x:vb[i]) { myset.erase(x); } } return 1; }

Compilation message (stderr)

teams.cpp:1:32: warning: '-std=c++11' is not an option that controls warnings [-Wpragmas]
    1 | #pragma GCC diagnostic warning "-std=c++11"
      |                                ^~~~~~~~~~~~
teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:16:15: warning: declaration of 'N' shadows a global declaration [-Wshadow]
   16 | void init(int N, int A[], int B[]) {
      |           ~~~~^
teams.cpp:13:11: note: shadowed declaration is here
   13 | const int N=5e5+5;
      |           ^
teams.cpp: In function 'int can(int, int*)':
teams.cpp:33:19: warning: comparison of integer expressions of different signedness: 'std::set<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} [-Wsign-compare]
   33 |   if (myset.size()<vk[i]) return 0;
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...