답안 #1062917

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1062917 2024-08-17T11:52:43 Z jamjanek 카니발 티켓 (IOI20_tickets) C++14
27 / 100
326 ms 51480 KB
#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;

void usun(vector<int>&ile, set<pair<int, int>>&ilejedynek, int x){
	pair<int,int> it = {ile[x], x};
	ilejedynek.erase(it);
	ile[it.second]--;
	ilejedynek.insert({it.first-1, it.second});
	
}

long long find_maximum(int k, std::vector<std::vector<int>> x) {
	int n = x.size();
	int m = x[0].size();
	int i, j;

	vector<vector<int>>answer = x;
	for(i=0;i<n;i++)
		for(j=0;j<m;j++)
			answer[i][j] = -1;
	long long wynik = 0;
	for(int war=0;war<k;war++){
		vector<pair<long long, int>>srednie;
		vector<int>pozmini(n), pozmaxi(n);
		for(i=0;i<n;i++){
			int mini = 1000000010, maxi = -1000000010;
			for(j=0;j<m;j++)
				if(x[i][j]!=-1)
					mini = min(mini, x[i][j]), maxi = max(maxi, x[i][j]);
			for(j=0;j<m;j++){
				if(mini==x[i][j])
					pozmini[i] = j;
				if(maxi==x[i][j])
					pozmaxi[i] = j;
			}
			srednie.push_back({(long long)mini+maxi, i});
		}
		sort(srednie.begin(), srednie.end());
		for(i=0;i<n;i++){
			int j = srednie[i].second;
			if(i<n/2){
				answer[j][pozmini[j]] = war; 
				wynik-=x[j][pozmini[j]];
				x[j][pozmini[j]] = -1;
			}
			else{
				answer[j][pozmaxi[j]] = war; 
				wynik+=x[j][pozmaxi[j]];
				x[j][pozmaxi[j]] = -1;
			}
		}
	}
	allocate_tickets(answer);
	return wynik;
	
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 14 ms 2396 KB Output is correct
6 Correct 326 ms 51480 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Contestant returned 5 while correct return value is 6.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Contestant returned 11 while correct return value is 13.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Contestant returned 11 while correct return value is 13.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Contestant returned 11 while correct return value is 13.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 600 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 600 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 14 ms 2396 KB Output is correct
12 Correct 326 ms 51480 KB Output is correct
13 Incorrect 0 ms 348 KB Contestant returned 5 while correct return value is 6.
14 Halted 0 ms 0 KB -