제출 #307145

#제출 시각아이디문제언어결과실행 시간메모리
307145Ruxandra985카니발 티켓 (IOI20_tickets)C++14
11 / 100
2 ms768 KiB
#include <bits/stdc++.h> #include "tickets.h" #define DIMN 1510 #define MLD 1000000000 using namespace std; pair <int , int> v[2 * DIMN]; int f[DIMN]; long long find_maximum(int k, vector<vector<int>> x) { int n = x.size() , i , pv , pw , elem; int m = x[0].size(); long long sol = 0; vector<vector<int>> answer; for (i = 0; i < n; i++) { vector<int> row; row.resize(m , -1); answer.push_back(row); } if (m == 1){ for (i = 0 ; i < n ; i++){ answer[i][0] = 0; v[i] = make_pair(x[i][0] , i); } sort (v , v + n); for (i = 0 ; i < n ; i++){ if (i < n / 2) sol = sol - v[i].first; else sol = sol + v[i].first; } } else if (k == 1){ elem = 0; for (i = 0 ; i < n ; i++){ v[++elem] = make_pair(x[i][0] , i + 1); v[++elem] = make_pair(MLD - x[i].back() , -i - 1); } sort (v + 1 , v + elem + 1); sol = 1LL * MLD * n / 2; for (i = 1 ; i <= elem ; i++){ if (f[max(v[i].second , -v[i].second) - 1] == 0){ sol -= v[i].first; if (v[i].second >= 0) answer[v[i].second - 1][0] = 0; else answer[-v[i].second - 1][m - 1] = 0; f[max(v[i].second , -v[i].second) - 1] = 1; } } } allocate_tickets(answer); return sol; }

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

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:13:25: warning: unused variable 'pv' [-Wunused-variable]
   13 |  int n = x.size() , i , pv , pw , elem;
      |                         ^~
tickets.cpp:13:30: warning: unused variable 'pw' [-Wunused-variable]
   13 |  int n = x.size() , i , pv , pw , elem;
      |                              ^~
#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...