제출 #652078

#제출 시각아이디문제언어결과실행 시간메모리
652078mychecksedad카니발 티켓 (IOI20_tickets)C++17
27 / 100
485 ms70700 KiB
#include <bits/stdc++.h> using namespace std; typedef long long int ll; #define pb push_back #define all(x) x.begin(), x.end() void allocate_tickets(vector<vector<int>> _x); long long find_maximum(int k, vector<vector<int>> _arr) { vector<deque<ll>> arr (_arr.size()); for(int i = 0; i < _arr.size(); ++i){ for(int x: _arr[i]) arr[i].pb(x); } int n = arr.size(); int m = arr[0].size(); vector<vector<int>> answer; for (int i = 0; i < n; i++) { std::vector<int> row(m, -1); answer.push_back(row); } ll ans = 0; vector<int> popped(n); for(int _ = 0; _ < k; ++_){ vector<pair<ll, int>> a; for(int i = 0; i < n; ++i) a.pb({arr[i][0] + arr[i][m - 1], i}); sort(all(a)); for(int i = 0; i < n/2; ++i){ int x = a[n - i - 1].second, y = a[i].second; ans += arr[x][m - 1] - arr[y][0]; answer[x][m - 1] = _; answer[y][popped[y]] = _; arr[x].pop_back(); arr[y].pop_front(); popped[y]++; } m--; } allocate_tickets(answer); return ans; }

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

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