# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1082175 | 2024-08-30T19:45:03 Z | wood | Carnival Tickets (IOI20_tickets) | C++17 | 1 ms | 348 KB |
#include "tickets.h" #include <vector> #include <bits/stdc++.h> using namespace std; #define vi vector<int> #define ll long long #define pb push_back long long find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size(), m = x[0].size(); vector<vi> ans; for(int i = 0; i<n; i++) ans.pb({0}); ll l = 0, r = 1e10; while (r-l>1){ ll mid = (r+l)/2; ll dif = 0; for(int i = 0; i<n; i++) dif+=mid-x[i][0]; if(dif<0) l = mid; else r=mid; } ll ldif = 0, rdif = 0; for(int i = 0; i<n; i++) ldif+=abs(l-x[i][0]); for(int i = 0; i<n; i++) rdif+=abs(r-x[i][0]); allocate_tickets(ans); return min(ldif,rdif); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Contestant returned 18919508441 but the tickets gives a total value of 18973753469 |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | WA in grader: allocate_tickets called with parameter of wrong size |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | WA in grader: allocate_tickets called with parameter of wrong size |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | WA in grader: allocate_tickets called with parameter of wrong size |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | WA in grader: allocate_tickets called with parameter of wrong size |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | WA in grader: allocate_tickets called with parameter of wrong size |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Contestant returned 18919508441 but the tickets gives a total value of 18973753469 |
5 | Halted | 0 ms | 0 KB | - |