제출 #779371

#제출 시각아이디문제언어결과실행 시간메모리
779371kamelfanger83카니발 티켓 (IOI20_tickets)C++17
0 / 100
1 ms284 KiB
#include "tickets.h" #include <vector> #include <algorithm> #include <numeric> #include <cassert> #define int long long using namespace std; long long find_maximum(signed k, vector<vector<signed>> x) { int n = x.size(); int m = x[0].size(); vector<vector<signed>> answer (n, vector<signed> (m, -1)); int ans = 0; vector<int> cuts (n, 0); for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { if (x[i][j] == 0) cuts[i] = j + 1; } } vector<int> oprov (n); iota(oprov.begin(), oprov.end(), 0); sort(oprov.begin(), oprov.end(), [&](int a, int b){return cuts[a] > cuts[b];}); int uz, uo; for (int i = 0; i < n; ++i) { uz += min(cuts[i], (int)k); uo += min(m - cuts[i], (int)k); } ans = min(uz, uo); for (int i = 0; i < k; ++i) { for (int j = 0; j < n / 2; ++j) { answer[oprov[j]][i] = i; } for (int j = n/2; j < n; ++j) { answer[oprov[j]][m-i-1] = i; } } allocate_tickets(answer); return ans; }

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

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:29:13: warning: 'uo' may be used uninitialized in this function [-Wmaybe-uninitialized]
   29 |     int uz, uo;
      |             ^~
tickets.cpp:29:9: warning: 'uz' may be used uninitialized in this function [-Wmaybe-uninitialized]
   29 |     int uz, uo;
      |         ^~
#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...