제출 #318541

#제출 시각아이디문제언어결과실행 시간메모리
318541giorgigagua2006카니발 티켓 (IOI20_tickets)C++17
100 / 100
969 ms65200 KiB
#include<bits/stdc++.h> #include "tickets.h" using namespace std; long long i,j,n,m,res; long long find_maximum(int k, std::vector<std::vector<int>> x) { n=x.size(); m=x[0].size(); vector<vector<int>>answer(n,vector<int>(m,-1)); vector<int>v(n,0); set<pair<long long,int>>s; for(int i=0;i<n;i++) { for(int j=m-k;j<m;j++) res+=x[i][j]; s.insert({x[i][0]+x[i][m-k],i}); } for(j=0;j<k*n/2;j++){ auto p=*s.begin(); int val=p.first; int i=p.second; res-=val; s.erase(*s.begin()); v[i]++; int a=v[i]; if(a<k) s.insert(make_pair(x[i][a]+x[i][m-k+a],i)); } int res1=0; int r=0; for(int i=0;i<n;i++) { for(int j=0;j<v[i];j++) { answer[i][j]=r; r++; r%=k; } int rr=r; for(int j=m-k+v[i];j<m;j++) { answer[i][j]=rr; rr++; rr%=k; } } allocate_tickets(answer); return res; }

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

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:29:9: warning: unused variable 'res1' [-Wunused-variable]
   29 |     int res1=0;
      |         ^~~~
#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...