제출 #399976

#제출 시각아이디문제언어결과실행 시간메모리
399976faresbasbs카니발 티켓 (IOI20_tickets)C++14
11 / 100
2 ms716 KiB
#include <bits/stdc++.h> #include "tickets.h" using namespace std; int n,m,l[1501],r[1501]; long long find_maximum(int k, vector<vector<int>> x){ n = x.size() , m = x[0].size(); vector<pair<int,int>> v,vals; for(int i = 0 ; i < n ; i += 1){ r[i] = m-1; vals.push_back({0,i}); for(int j = 0 ; j < m ; j += 1){ v.push_back({x[i][j],i}); } } sort(v.begin(),v.end()); vector<vector<int>> ans(n,vector<int>(m,-1)); long long ret = 0; for(int i = 0 ; i < v.size()/2 ; i += 1){ ret -= v[i].first; } for(int i = v.size()/2 ; i < v.size() ; i += 1){ ret += v[i].first; vals[v[i].second].first += 1; } for(int i = 0 ; i < k ; i += 1){ sort(vals.begin(),vals.end()); for(int j = 0 ; j < n/2 ; j += 1){ int p = vals[j].second; ans[p][l[p]] = i; l[p] += 1; } for(int j = n/2 ; j < n ; j += 1){ int p = vals[j].second; ans[p][r[p]] = i; r[p] -= 1; v[j].first -= 1; } } allocate_tickets(ans); return ret; }

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

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:19:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |  for(int i = 0 ; i < v.size()/2 ; i += 1){
      |                  ~~^~~~~~~~~~~~
tickets.cpp:22:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |  for(int i = v.size()/2 ; i < v.size() ; i += 1){
      |                           ~~^~~~~~~~~~
#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...