Submission #377393

#TimeUsernameProblemLanguageResultExecution timeMemory
377393ThistleCarnival Tickets (IOI20_tickets)C++14
11 / 100
2 ms748 KiB
#include "tickets.h" #include <vector> #include<algorithm> #include<set> #include<iostream> #include<random> #include<queue> #include<cassert> using namespace std; using ll=long long; using H=pair<ll, ll>; #define vec vector #define vi vec<ll> #define pb push_back #define all(a) (a).begin(),(a).end() #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++) #define rep(i,n) rng((i),0,(n)) #define siz(a) int((a).size()) long long find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size(); int m = x[0].size(); std::vector<std::vector<int>> answer(n,vec<int>(m,-1)); ll ans=0; if(m==1){ vi v; rep(i,n) v.pb(x[i][0]); sort(all(v)); rep(i,n){ if(i<n/2) ans-=v[i]; else ans+=v[i]; } rep(i,n)rep(j,m) answer[i][j]=0; } allocate_tickets(answer); return ans; }

Compilation message (stderr)

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:16:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   16 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
tickets.cpp:17:18: note: in expansion of macro 'rng'
   17 | #define rep(i,n) rng((i),0,(n))
      |                  ^~~
tickets.cpp:31:3: note: in expansion of macro 'rep'
   31 |   rep(i,n) v.pb(x[i][0]);
      |   ^~~
tickets.cpp:16:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   16 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
tickets.cpp:17:18: note: in expansion of macro 'rng'
   17 | #define rep(i,n) rng((i),0,(n))
      |                  ^~~
tickets.cpp:33:3: note: in expansion of macro 'rep'
   33 |   rep(i,n){
      |   ^~~
tickets.cpp:16:28: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   16 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
tickets.cpp:17:18: note: in expansion of macro 'rng'
   17 | #define rep(i,n) rng((i),0,(n))
      |                  ^~~
tickets.cpp:37:3: note: in expansion of macro 'rep'
   37 |   rep(i,n)rep(j,m) answer[i][j]=0;
      |   ^~~
tickets.cpp:16:28: warning: unnecessary parentheses in declaration of 'j' [-Wparentheses]
   16 | #define rng(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
      |                            ^
tickets.cpp:17:18: note: in expansion of macro 'rng'
   17 | #define rep(i,n) rng((i),0,(n))
      |                  ^~~
tickets.cpp:37:11: note: in expansion of macro 'rep'
   37 |   rep(i,n)rep(j,m) answer[i][j]=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...