QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#665622 | #9470. Cats and Fish | Moemi_ | AC ✓ | 1ms | 3800kb | C++20 | 1.5kb | 2024-10-22 14:28:17 | 2024-10-22 14:28:45 |
Judging History
answer
#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>
#include <vector>
#include <set>
#include <queue>
#include <cmath>
#include <stack>
#include <cstring>
#include <iomanip>
#include <unordered_map>
#include <numeric>
#define sc_int(x) scanf("%d", &x)
#define x first
#define y second
#define pb push_back
using namespace std;
const int N = 1010, M = 50, MOD = 1e9 + 7;
const int inf = 1e9;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<double, double> PDD;
typedef pair<char, int> PCI;
typedef pair<string, string> PSS;
int n, m, x;
void solve()
{
vector<int> a(n);
for(auto &t : a) cin >> t;
vector<int> ed(n);
sort(a.begin(), a.end());
int ans1 = m, ans2 = 0;
map<int, int> v;
for(int i = 1; i <= x; i ++)
{
if(ans1 == 0 && ans2 == 0) break;
for(int j = 0; j < n; j ++)
{
if(ed[j] == a[j]) ans2 --, ed[j] = 0, v[j] = 0;
if(!ed[j] && ans1) ans1 --, ans2 ++, v[j] = 1;
if(v[j]) ed[j] ++;
}
}
for(int i = 0; i < n; i ++)
{
if(ed[i] == a[i]) ans2 --;
}
cout << ans1 << " " << ans2 << endl;
}
int main()
{
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int T = 1;
// cin >> T;
while(cin >> m >> n >> x)
{
solve();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3800kb
input:
2 1 1 1 8 3 5 1 3 4 4 5 1 5 4 3 2 1
output:
1 0 0 1 0 3
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 1ms
memory: 3764kb
input:
1 1 10 1 14 3 10 1 40 50 8 2 7 12 13 1 1 1 2 12 2 11 8 3 2 2 12 24 1 562 8 232 17 26 800 12 77 32 11 2 562 8 1 17 26 800 12 77 32 11 1 3656 13 123 1887 26 800 12 77 32 11 1 77 32 77 32 155
output:
0 0 2 2 6 2 0 1 6 2 0 1 368 7 554 7 3484 12
result:
ok 9 lines