Submission #946169

#TimeUsernameProblemLanguageResultExecution timeMemory
946169Nika533Teams (IOI15_teams)C++14
0 / 100
4093 ms84536 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<int> 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]); vb[b[i]].pb(b[i]); } } int can(int M, int K[]) { vector<int> vk[n+5]; for (int i=0; i<M; i++) vk[K[i]].pb(i); multiset<int> myset; for (int i=1; i<=n; i++) { for (auto x:va[i]) { myset.insert(x); } for (auto x:vk[i]) { if (myset.size()<i) return 0; int j=i; while (j--) myset.erase(myset.begin()); } for (auto x:vb[i]) { myset.erase(myset.find(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:16:31: warning: unused parameter 'B' [-Wunused-parameter]
   16 | void init(int N, int A[], int B[]) {
      |                           ~~~~^~~
teams.cpp: In function 'int can(int, int*)':
teams.cpp:34:20: warning: comparison of integer expressions of different signedness: 'std::multiset<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |    if (myset.size()<i) return 0;
      |        ~~~~~~~~~~~~^~
teams.cpp:33:13: warning: unused variable 'x' [-Wunused-variable]
   33 |   for (auto x:vk[i]) {
      |             ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...