제출 #314514

#제출 시각아이디문제언어결과실행 시간메모리
314514CodeKracker카니발 티켓 (IOI20_tickets)C++14
27 / 100
738 ms51448 KiB
/*input */ /** Author: Kristopher Paul Date Created: 30-09-2020 **/ #include<bits/stdc++.h> #include<stdio.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> #define ll long long //#define int ll #define pb push_back #define INF 1e18 //#define MOD 1000000007 #define MOD 998244353 #define mp make_pair const double PI=3.141592653589793238462643383279502884197169399375105820974944; #define REP(i,n) for (int i = 0; i < n; i++) #define FOR(i,a,b) for (int i = a; i < b; i++) #define REPD(i,n) for (int i = n-1; i >= 0; i--) #define FORD(i,a,b) for (int i = a; i >= b; i--) #define remax(a,b) a = max(a,b) #define remin(a,b) a = min(a,b) #define umap map #define pii pair<int,int> #define F first #define S second #define mii map<int,int> #define vi vector<int> #define vvi vector<vi> #define itr :: iterator it #define all(v) v.begin(),v.end() #define WL(t) while(t--) #define gcd(a,b) __gcd((a),(b)) #define lcm(a,b) ((a)*(b))/gcd((a),(b)) #define out(x) cout << #x << " is " << x << endl #define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); using namespace std; //Uncomment for File I/O //ifstream fin("input.in") //using namespace __gnu_pbds; //typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // set //typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // multiset int ModExp(int x,int y,int m){ int res = 1; x = x % m; while (y > 0) { if (y & 1) res = (res*x) % m; y = y>>1; x = (x*x) % m; } return res; } void allocate_tickets(vector<vi> s); long long find_maximum(int k,vector<vi> x){ int n = x.size(); int m = x[0].size(); int mn[n]; int mx[n]; long long ans = 0; priority_queue<pii> pq; FOR(i,0,n){ int tmn = 1e9; int tmx = -1e9; FOR(j,0,m){ remin(tmn,x[i][j]); remax(tmx,x[i][j]); } mn[i] = tmn; mx[i] = tmx; ans += mx[i]; pq.push({(-tmn-tmx),i}); } bool ismn[n] = {}; int todo = n/2; while(!pq.empty() && todo > 0){ ans += pq.top().F; ismn[pq.top().S] = true; todo--; pq.pop(); } vector<vi> res(n,vi(m,-1)); FOR(i,0,n){ FOR(j,0,m){ if(x[i][j] == mx[i] && ismn[i] == false){ res[i][j] = 0; break; } if(x[i][j] == mn[i] && ismn[i] == true){ res[i][j] = 0; break; } } } allocate_tickets(res); return ans; }
#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...