제출 #946171

#제출 시각아이디문제언어결과실행 시간메모리
946171Nika533Teams (IOI15_teams)C++14
0 / 100
4102 ms78008 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]) {
			if (myset.find(x)!=myset.end()) myset.erase(myset.find(x));
		}
	}
	return 1;
}

컴파일 시 표준 에러 (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...