제출 #302685

#제출 시각아이디문제언어결과실행 시간메모리
302685cgiosy카니발 티켓 (IOI20_tickets)C++17
100 / 100
1014 ms53496 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; using ll=long long; #define R(i,n,...) for(int i=__VA_ARGS__+0; i<(n); ++i) struct pii { int x, i; bool operator<(const pii b) const { return x<b.x; } }; struct iii { int x, y, i; bool operator<(const iii b) const { return x>b.x || x==b.x && y<b.y; } }; ll find_maximum(int K, vector<vector<int>> A) { const int N=A.size(), M=A[0].size(), X=N*K/2; ll sum=0; vector<pii> B(N*K); R(i, N) { R(j, K) { sum+=A[i][M-K+j]; B[i*K+j]={A[i][M-K+j]+A[i][j], i}; } fill(begin(A[i]), end(A[i]), -1); } sort(begin(B), end(B)); vector<int> C(N); vector<iii> L(N); R(i, X) sum-=B[i].x, C[B[i].i]++; R(i, N) L[i]={C[i], K-C[i], i}; R(i, K) { sort(begin(L), end(L)); R(j, N/2) A[L[j].i][--L[j].x]=i; R(j, N, N/2) A[L[j].i][M-L[j].y--]=i; } allocate_tickets(A); return sum; }

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

tickets.cpp: In member function 'bool iii::operator<(iii) const':
tickets.cpp:13:61: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   13 |  bool operator<(const iii b) const { return x>b.x || x==b.x && y<b.y; }
      |                                                      ~~~~~~~^~~~~~~~
#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...