답안 #946169

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
946169 2024-03-14T11:39:03 Z Nika533 팀들 (IOI15_teams) C++14
0 / 100
4000 ms 84536 KB
#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

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]) {
      |             ^
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 27228 KB Output is correct
2 Correct 6 ms 27228 KB Output is correct
3 Correct 6 ms 27228 KB Output is correct
4 Correct 6 ms 27072 KB Output is correct
5 Incorrect 6 ms 27228 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 33584 KB Output is correct
2 Correct 20 ms 33740 KB Output is correct
3 Incorrect 36 ms 37920 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 58 ms 34296 KB Output is correct
2 Correct 67 ms 34504 KB Output is correct
3 Execution timed out 4019 ms 38940 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 349 ms 62580 KB Output is correct
2 Correct 310 ms 62524 KB Output is correct
3 Execution timed out 4093 ms 84536 KB Time limit exceeded
4 Halted 0 ms 0 KB -