제출 #579779

#제출 시각아이디문제언어결과실행 시간메모리
579779AugustinasJucas콤보 (IOI18_combo)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "tickets.h" using namespace std; vector<vector<int> > mas, ans; vector<vector<pair<int, int> > > maz, did, pos; long long check(int n, int m, int k) { vector<vector<int> > vec(m); for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { if(ans[i][j] == -1) continue; vec[ans[i][j]].push_back(mas[i][j]); } } long long ret = 0; for(int i = 0; i < k; i++) { sort(vec[i].begin(), vec[i].end()); for(int j = 0; j < vec[i].size(); j++) { if(j < vec[i].size() / 2) { ret -= vec[i][j]; }else { ret += vec[i][j]; } } } return ret; } /* 2 3 3 1 2 3 3 1 4 */ long long find_maximum(int k, vector<vector<int> > x) { int n = x.size(); int m = x[0].size(); mas = ans = x; for(auto &x : ans) for(auto &y : x) y = -1; maz.resize(n); did.resize(n); pos.resize(n); long long sum = 0; priority_queue<pair<long long, int> > q; for(int i = 0; i < n; i++) { vector<pair<int, int> > dd, mm; for(int j = 0; j < m; j++) { dd.push_back({x[i][j], j}); mm.push_back({x[i][j], j}); } sort(mm.begin(), mm.end()); sort(dd.begin(), dd.end()); reverse(dd.begin(), dd.end()); for(int j = 0; j < k; j++) { sum -= mm[j].first; maz[i].push_back(mm[j]); pos[i].push_back(dd[j]); } reverse(pos[i].begin(), pos[i].end()); q.push({pos[i].back().first + maz[i].back().first, i}); } //cout << "kai visi minusai, sum = " << sum << endl; for(int i = 0; i < n * k / 2; i++) { long long pl = q.top().first; int ind = q.top().second; q.pop(); sum += pl; //cout << "taciau galiu paimti ir sukeisti eileje " << ind << ", " << maz[ind].back().second << " su " << pos[ind].back().second << endl; maz[ind].pop_back(); did[ind].push_back(pos[ind].back()); pos[ind].pop_back(); if(pos[ind].size()) { q.push({pos[ind].back().first + maz[ind].back().first, ind}); } } /*cout << "taigi:\n"; for(int i = 0; i < n; i++) { cout << "eileje " << i << ", minusai: "; for(auto &x : maz[i]) cout << x.second << " "; cout << ", pliusai: "; for(auto x : did[i]) cout << x.second << " "; cout << endl; }*/ /* for(int i = 0; i < n; i++) { for(auto &x : maz[i]) ans[] } */ vector<pair<int, int> > bal (k); for(int i = 0; i < k; i++) { bal[i] = {0, i}; } // cout << "start" << endl; for(int i = 0; i < n; i++) { int i1 = 0; int i2 = 0; for(int jj = 0; jj < k; jj++) { int j = bal[jj].second; if(i1 == did[i].size()) { ans[i][maz[i][i2].second] = j; i2++; }else { if(bal[jj].first != n / 2) { ans[i][did[i][i1].second] = j; i1++; bal[jj].first++; }else { // cout << "i2 = " << i2 << ", maz[i].size() = " << maz[i].size() << endl; ans[i][maz[i][i2].second] = j; i2++; } } } sort(bal.begin(), bal.end()); } allocate_tickets(ans); //auto turi = check(n, m,k); //cout << "turi " << turi << endl; return sum; /* 2 3 2 0 2 5 1 1 3 4 2 1 5 9 1 4 3 6 2 7 */ //allocate_tickets(answer); }

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

combo.cpp:2:10: fatal error: tickets.h: No such file or directory
    2 | #include "tickets.h"
      |          ^~~~~~~~~~~
compilation terminated.