제출 #331627

#제출 시각아이디문제언어결과실행 시간메모리
331627pggpCarnival Tickets (IOI20_tickets)C++14
11 / 100
2 ms748 KiB
#include <bits/stdc++.h>
#include "tickets.h"

using namespace std;

void allocate_tickets(vector < vector < int > > s);

long long find_maximum(int k, vector < vector < int > > x){
	int n = x.size();
	int m = x[0].size();
	long long ans = 0;
	vector < vector < int > > to_allocate;
	for(vector < int > t : x){
		vector < int > a;
		to_allocate.push_back(a);
		for(int i : t){
			to_allocate[to_allocate.size() - 1].push_back(-1);
			
		}
	}

	if(m == 1){

		vector < int > v;
		for(int i = 0; i < x.size(); i++){
			for(int j = 0; j < x[i].size(); j++){
				to_allocate[i][j] = 0;
				v.push_back(x[i][j]);
			}
		}
		
		sort(v.begin(), v.end());
		
		for (int i = 0; i < v.size(); ++i)
		{
			if(i < v.size() / 2){
				ans -= v[i];
			}
			else{
				ans += v[i];
			}
		}
	}

	

	allocate_tickets(to_allocate);
	return ans;
}

컴파일 시 표준 에러 (stderr) 메시지

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:16:11: warning: unused variable 'i' [-Wunused-variable]
   16 |   for(int i : t){
      |           ^
tickets.cpp:25:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |   for(int i = 0; i < x.size(); i++){
      |                  ~~^~~~~~~~~~
tickets.cpp:26:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |    for(int j = 0; j < x[i].size(); j++){
      |                   ~~^~~~~~~~~~~~~
tickets.cpp:34:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |   for (int i = 0; i < v.size(); ++i)
      |                   ~~^~~~~~~~~~
tickets.cpp:36:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |    if(i < v.size() / 2){
      |       ~~^~~~~~~~~~~~~~
tickets.cpp:9:6: warning: unused variable 'n' [-Wunused-variable]
    9 |  int n = x.size();
      |      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...