Submission #302371

#TimeUsernameProblemLanguageResultExecution timeMemory
302371Sho10Carnival Tickets (IOI20_tickets)C++14
27 / 100
810 ms87252 KiB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10 #include "tickets.h" #define ll long long #define double long double #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define all(a) (a).begin(), (a).end() #define sz size #define f first #define s second #define pb push_back #define er erase #define in insert #define mp make_pair #define pi pair #define rc(s) return cout<<s,0 #define endl '\n' #define mod 1000000007 #define PI 3.14159265359 #define MAXN 100005 #define INF 1000000005 #define LINF 1000000000000000005ll #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; ll a[2005][2005],res[2005][2005],ans=0; ll find_maximum(int K,vector<vector<int>>x){ ll n=x.size(); ll m=x[0].size(); ll k=K; for(ll i=1;i<=n;i++) { for(ll j=1;j<=m;j++) { a[i][j]=x[i-1][j-1]; } } priority_queue<pair<ll,ll>>q; for(ll i=1;i<=n;i++) { ans-=a[i][1]; q.push(mp(a[i][1]+a[i][m],i)); res[i][1]=1; } for(ll i=0;i<n/2;i++) { pair<ll,ll>p=q.top(); q.pop(); ans+=p.f; res[p.s][1]=0; res[p.s][m]=1; } vector<vector<int>>rasp; rasp.resize(n); for(ll i=1;i<=n;i++){ for(ll j=1;j<=m;j++) { rasp[i-1].pb(res[i][j]-1); } } allocate_tickets(rasp); return ans; } /* int32_t main(){ CODE_START; */

Compilation message (stderr)

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