Submission #431178

# Submission time Handle Problem Language Result Execution time Memory
431178 2021-06-17T10:08:42 Z A_D Carnival Tickets (IOI20_tickets) C++14
11 / 100
2 ms 588 KB
#include "tickets.h"
#include <bits/stdc++.h>
using namespace std;
long long find_maximum(int k,vector<vector<int>>x){
    /*
    for(auto xx:x){
        for(auto y:xx){
            cout<<y<<" ";
        }
        cout<<endl;
    }
    */
	vector<vector<int>> ans;
	vector<int> vec;
	for(int i=0;i<x.size();i++){
        vec.push_back(0);
        ans.push_back(vec);
        vec.clear();
	}
	allocate_tickets(ans);
	vec.clear();
	for(int i=0;i<x.size();i++){
        vec.push_back(x[i][0]);
	}
	sort(vec.begin(),vec.end());
	int sz=vec.size();
	long long ann=0;
//	for(auto x:vec)cout<<x<<" ";cout<<endl;
	for(int i=0;i<sz/2;i++){
        ann-=vec[i];
	}
	for(int i=sz/2;i<sz;i++){
        ann+=vec[i];
	}
	return ann;
}

Compilation message

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:15:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |  for(int i=0;i<x.size();i++){
      |              ~^~~~~~~~~
tickets.cpp:22:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  for(int i=0;i<x.size();i++){
      |              ~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 2 ms 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB WA in grader: allocate_tickets called with parameter of wrong size
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB WA in grader: allocate_tickets called with parameter of wrong size
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB WA in grader: allocate_tickets called with parameter of wrong size
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB WA in grader: allocate_tickets called with parameter of wrong size
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB WA in grader: allocate_tickets called with parameter of wrong size
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 2 ms 588 KB Output is correct
7 Incorrect 0 ms 204 KB WA in grader: allocate_tickets called with parameter of wrong size
8 Halted 0 ms 0 KB -