제출 #819909

#제출 시각아이디문제언어결과실행 시간메모리
819909Abrar_Al_Samit카니발 티켓 (IOI20_tickets)C++17
0 / 100
1 ms340 KiB
#include "tickets.h" #include <bits/stdc++.h> using namespace std; const int nax = 1500; int n, m; int cnt[nax][2]; vector<int>pz[nax], po[nax]; int ptr[nax][2]; long long find_maximum(int k, vector<vector<int>> x) { n = x.size(); m = x[0].size(); for(int i=0; i<n; ++i) { for(int j=0; j<m; ++j) { if(x[i][j]==1) { po[i].push_back(j); } else { pz[i].push_back(j); } } } vector<vector<int>>ans(n, vector<int>(m, -1)); for(int i=0; i<n; ++i) { for(int j=0; j<k; ++j) { if(cnt[j][0] < n/2 && pz[i].size()>ptr[i][0]) { ++cnt[j][0]; ans[i][pz[i][ptr[i][0]]] = j; ++ptr[i][0]; } else if(cnt[j][1] < n/2 && po[i].size()>ptr[i][1]) { ++cnt[j][1]; ans[i][po[i][ptr[i][1]]] = j; ++ptr[i][1]; } else if(pz[i].size()>ptr[i][0]) { ++cnt[j][0]; ans[i][pz[i][ptr[i][0]]] = j; ++ptr[i][0]; } else { ++cnt[j][1]; ans[i][po[i][ptr[i][1]]] = j; ++ptr[i][1]; } } } int mx_ans = 0; for(int i=0; i<k; ++i) { mx_ans += min(cnt[i][0], cnt[i][1]); } allocate_tickets(ans); return mx_ans; }

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

tickets.cpp: In function 'long long int find_maximum(int, std::vector<std::vector<int> >)':
tickets.cpp:30:38: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |    if(cnt[j][0] < n/2 && pz[i].size()>ptr[i][0]) {
      |                          ~~~~~~~~~~~~^~~~~~~~~~
tickets.cpp:34:45: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   34 |    } else if(cnt[j][1] < n/2 && po[i].size()>ptr[i][1]) {
      |                                 ~~~~~~~~~~~~^~~~~~~~~~
tickets.cpp:38:26: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   38 |    } else if(pz[i].size()>ptr[i][0]) {
      |              ~~~~~~~~~~~~^~~~~~~~~~
#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...