Submission #793556

# Submission time Handle Problem Language Result Execution time Memory
793556 2023-07-26T01:56:38 Z UltraFalcon Teams (IOI15_teams) C++17
0 / 100
353 ms 42820 KB
// pragmas
#ifndef DEBUG

#endif

#include <bits/stdc++.h>
#include "teams.h"

// #define int long long
using ll = long long;

using namespace std;

int N;
vector<int> A;
vector<int> B;
vector<array<int, 2>> students_b;
set<array<int, 2>> students_a;

void init(int _N, int _A[], int _B[]) {
	N = _N;
	A.assign(N, -1);
	for (int i=0; i<N; i++) {
		A[i] = _A[i];
	}
	B.assign(N, -1);
	for (int i=0; i<N; i++) {
		B[i] = _B[i];
	}

	students_b.clear();
	for (int i=0; i<N; i++) {
		students_b.push_back({B[i], i});
	}
	sort(students_b.begin(), students_b.end());
	students_a.clear();
	for (int i=0; i<N; i++) {
		students_a.insert({A[i], i});
	}
}

int can(int M, int K[]) {
	
	int j = 0;
	for (int i=0; i<M; i++) {
		while (j<N && students_b[j][0]<K[i]) {
			int idx = students_b[j][1];
			if (students_a.count({A[idx], idx})) 
				students_a.erase({A[idx], idx});
			j++;
		}
		for (int l=0; l<K[i]; l++) {
			if (students_a.empty()) return 0;
			students_a.erase(students_a.begin());
		}
	}

	return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 300 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 42 ms 8484 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 8740 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 353 ms 42820 KB Output isn't correct
2 Halted 0 ms 0 KB -