제출 #384965

#제출 시각아이디문제언어결과실행 시간메모리
384965Ahmadsm2005카니발 티켓 (IOI20_tickets)C++14
11 / 100
5 ms876 KiB
#include <bits/stdc++.h> //#include "grader.cpp" #include "tickets.h" using namespace std; long long find_maximum(int k,vector<vector<int>> x) { int n = x.size(); long long CNT=0; int m = x[0].size(); vector<vector<int>>answer(n); for(int i=0;i<n;i++) for(int l=0;l<m;l++) answer[i].push_back(-1); set<pair<int,pair<int,int>>>lol; set<int>VIS; for(int i=0;i<n;i++){ for(int l=0;l<m;l++){ lol.insert({x[i][l],{i,l}}); } } int Z=0; for(int i=0;i<k;i++){ vector<int>TEMP; int N=n; while(N){ auto itr=lol.end(),itr2=lol.begin(); itr--; while(VIS.find((itr->second).first)!=VIS.end()) itr--; VIS.insert((itr->second).first); while(VIS.find((itr2->second).first)!=VIS.end()) itr2++; TEMP.push_back((itr->first)),TEMP.push_back((itr2->first)); answer[(itr->second).first][(itr->second).second]=Z; VIS.insert((itr2->second).first); answer[(itr2->second).first][(itr2->second).second]=Z; lol.erase(itr),lol.erase(itr2); N-=2; } Z++; sort(TEMP.begin(),TEMP.end()); int X=TEMP[(TEMP.size()-1)/2]; for(int i=0;i<TEMP.size();i++){ CNT+=abs(TEMP[i]-X); } VIS.clear(); } allocate_tickets(answer); return CNT; }

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

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