제출 #307754

#제출 시각아이디문제언어결과실행 시간메모리
307754cheetose카니발 티켓 (IOI20_tickets)C++17
100 / 100
1167 ms62500 KiB
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define X first #define Y second #define y0 y12 #define y1 y22 #define INF 987654321987654321 #define PI 3.141592653589793238462643383279502884 #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c)) #define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c)) #define MEM0(a) memset((a),0,sizeof(a)); #define MEM_1(a) memset((a),-1,sizeof(a)); #define ALL(a) a.begin(),a.end() #define SYNC ios_base::sync_with_stdio(false);cin.tie(0) using namespace std; typedef long long ll; typedef long double ld; typedef double db; typedef unsigned int uint; typedef unsigned long long ull; typedef pair<int, int> Pi; typedef pair<ll, ll> Pll; typedef pair<ld, ld> Pd; typedef vector<int> Vi; typedef vector<ll> Vll; typedef vector<db> Vd; typedef vector<Pi> VPi; typedef vector<Pll> VPll; typedef vector<Pd> VPd; typedef tuple<int, int, int> iii; typedef tuple<int, int, int, int> iiii; typedef tuple<ll, ll, ll> LLL; typedef vector<iii> Viii; typedef vector<LLL> VLLL; typedef complex<double> base; const int MOD = 1000000007; ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; } int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 }; int ddx[] = { -1,-2,1,-2,2,-1,2,1 }, ddy[] = { -2,-1,-2,1,-1,2,1,2 }; #include "tickets.h" int n,m,kk; /*void allocate_tickets(vector<Vi> &s){ int n=s.size(),m=s[0].size(); fup(i,0,n-1,1){ fup(j,0,m-1,1){ printf("%d ",s[i][j]); } puts(""); } }*/ int cnt[1500]; Pi p[1500]; ll find_maximum(int k, vector<Vi> x){ kk=k,n=x.size(),m=x[0].size(); vector<Vi> s(n,Vi(m,-1)); ll res=0; fup(i,0,n-1,1)fup(j,0,k-1,1)res-=x[i][j]; fup(i,0,n-1,1)p[i].Y=m,cnt[i]=k; priority_queue<Pi> q; fup(i,0,n-1,1){ fup(j,0,k-1,1)q.push(mp(x[i][j]+x[i][j+m-k],i)); } fup(K,1,n*k/2,1){ Pi P=q.top(); q.pop(); res+=P.X; p[P.Y].Y--; cnt[P.Y]--; } fup(K,0,k-1,1){ VPi vv(n); fup(i,0,n-1,1)vv[i]=mp(cnt[i],i); sort(ALL(vv)); fup(i,0,n/2-1,1){ int ii=vv[i].Y; s[ii][p[ii].Y++]=K; } fup(i,n/2,n-1,1){ int ii=vv[i].Y; s[ii][p[ii].X++]=K; cnt[ii]--; } } allocate_tickets(s); return res; }/* int main() { int n,m,k; scanf("%d%d%d",&n,&m,&k); vector<Vi> x(n,Vi(m)); fup(i,0,n-1,1)fup(j,0,m-1,1)scanf("%d",&x[i][j]); printf("%lld\n",find_maximum(k,x)); }*/

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

tickets.cpp: In function 'll find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
tickets.cpp:58:2: note: in expansion of macro 'fup'
   58 |  fup(i,0,n-1,1)fup(j,0,k-1,1)res-=x[i][j];
      |  ^~~
tickets.cpp:10:30: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
tickets.cpp:58:16: note: in expansion of macro 'fup'
   58 |  fup(i,0,n-1,1)fup(j,0,k-1,1)res-=x[i][j];
      |                ^~~
tickets.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
tickets.cpp:59:2: note: in expansion of macro 'fup'
   59 |  fup(i,0,n-1,1)p[i].Y=m,cnt[i]=k;
      |  ^~~
tickets.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
tickets.cpp:61:2: note: in expansion of macro 'fup'
   61 |  fup(i,0,n-1,1){
      |  ^~~
tickets.cpp:10:30: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
tickets.cpp:62:3: note: in expansion of macro 'fup'
   62 |   fup(j,0,k-1,1)q.push(mp(x[i][j]+x[i][j+m-k],i));
      |   ^~~
tickets.cpp:10:30: warning: unnecessary parentheses in declaration of 'K' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
tickets.cpp:64:2: note: in expansion of macro 'fup'
   64 |  fup(K,1,n*k/2,1){
      |  ^~~
tickets.cpp:10:30: warning: unnecessary parentheses in declaration of 'K' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
tickets.cpp:71:2: note: in expansion of macro 'fup'
   71 |  fup(K,0,k-1,1){
      |  ^~~
tickets.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
tickets.cpp:73:3: note: in expansion of macro 'fup'
   73 |   fup(i,0,n-1,1)vv[i]=mp(cnt[i],i);
      |   ^~~
tickets.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
tickets.cpp:75:3: note: in expansion of macro 'fup'
   75 |   fup(i,0,n/2-1,1){
      |   ^~~
tickets.cpp:10:30: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   10 | #define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
      |                              ^
tickets.cpp:79:3: note: in expansion of macro 'fup'
   79 |   fup(i,n/2,n-1,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...