# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
434241 | 2021-06-20T19:06:28 Z | ioi | Carnival Tickets (IOI20_tickets) | C++14 | 1 ms | 376 KB |
#include "tickets.h" #include <vector> #include<bits/stdc++.h> using namespace std ; const int N = 2000 ; vector<int> arr0[N] , arr1[N] ; long long find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size() , m = x[0].size(); vector<vector<int> > ans(n , vector<int> (m , -1)); //allocate_tickets(ans); long long b ; for(int i = 0 ; i < n; i ++){ for(int j = 0 ; j < m ; j ++){ if(x[i][j] == 1)arr1[i].push_back(j); else arr0[i].push_back(j); } } long long ret = 0 ; for(int kk = 0 ; kk < k ;kk++){ // try 0 int sum = 0 ; bool ok = true ; for(int i = 0 ; i < n && ok; i++){ if(arr0[i].size() == 0) ok = false ; } if(ok){ for(int i = 0 ; i < n ; i ++) ans[i][arr0[i].back()] = kk , arr0[i].pop_back() ; continue ; } ok = true ; for(int i = 0 ; i < n && ok ; i ++){ if(arr1[i].size() == 0) ok = false ; } if(ok){ for(int i = 0 ; i < n ; i ++) ans[i][arr1[i].back()] = kk , arr1[i].pop_back(); continue ; } for(int i = 0 ; i < n ; i ++){ if(arr0[i].empty()) sum ++ ; } int add = min(sum , n - sum); ret += add ; add = (add == sum ? 1 : 0); for(int i = 0 ; i < n ; i ++){ if(arr0[i].empty()){ ans[i][arr1[i].back()] = kk ; arr1[i].pop_back(); } else { ans[i][arr0[i].back()] = kk ; arr0[i].pop_back(); } } } allocate_tickets(ans); return ret ; /* int n = x.size(); int m = x[0].size(); std::vector<std::vector<int>> answer; for (int i = 0; i < n; i++) { std::vector<int> row(m); for (int j = 0; j < m; j++) { if (j < k) { row[j] = j; } else { row[j] = -1; } } answer.push_back(row); } allocate_tickets(answer); return 1; */ }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Contestant returned 298620960 but the tickets gives a total value of 0 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Contestant returned 803235448 but the tickets gives a total value of 0 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 376 KB | Contestant returned 1 while correct return value is 6. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Contestant returned 5 but the tickets gives a total value of 0 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Contestant returned 5 but the tickets gives a total value of 0 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Contestant returned 5 but the tickets gives a total value of 0 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 332 KB | Contestant returned 298620960 but the tickets gives a total value of 0 |
2 | Halted | 0 ms | 0 KB | - |