제출 #399974

#제출 시각아이디문제언어결과실행 시간메모리
399974faresbasbs카니발 티켓 (IOI20_tickets)C++14
0 / 100
1 ms204 KiB
#include <bits/stdc++.h> #include "tickets.h" using namespace std; int n,m; long long find_maximum(int k, vector<vector<int>> x){ n = x.size() , m = x[0].size(); vector<pair<int,pair<int,int>>> v; for(int i = 0 ; i < n ; i += 1){ for(int j = 0 ; j < m ; j += 1){ v.push_back({x[i][j],{i,j}}); } } 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; ans[v[i].second.first][v[i].second.second] = 0; } for(int i = v.size()/2 ; i < v.size() ; i += 1){ ret += v[i].first; ans[v[i].second.first][v[i].second.second] = 1; } for(int i = 0 ; i < k ; i += 1){ for(int j = 0 ; j < n ; j += 1){ if(j%2 == 0){ ans[j][i] = i; }else{ ans[j][m-i-1] = i; } } } // allocate_tickets(ans); return ret; }

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

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