QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#329438 | #1505. Last Supper | tuanlinh123 | 0 | 0ms | 0kb | C++20 | 2.3kb | 2024-02-16 18:06:15 | 2024-02-16 18:06:15 |
advisor
#include "advisor.h"
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;
void ComputeAdvice(int *c, int n, int k, int m)
{
vector <ll> cnt(n+k, 0), a(k), p(n);
iota(a.begin(), a.end(), n);
for (ll i=0; i<n; i++) p[i]=i<k?i:-1;
vector <vector <ll>> pos(n);
for (ll i=n-1; i>=0; i--) pos[c[i]].pb(i);
auto get=[&](ll i) {return pos[i].size()?pos[i].back():n+1;};
set <pll> s;
for (ll i=0; i<k; i++)
s.insert({get(i), i});
for (ll i=0; i<n; i++)
{
if (p[c[i]]!=-1)
{
cnt[a[p[c[i]]]]++;
s.erase(s.find({get(c[i]), c[i]}));
pos[c[i]].pop_back();
s.insert({get(c[i]), c[i]});
}
else
{
ll id=(*prev(s.end())).se;
s.erase(prev(s.end()));
pos[c[i]].pop_back();
a[p[id]]=i, p[c[i]]=p[id], p[id]=-1;
s.insert({get(c[i]), c[i]});
}
}
for (ll i=n; i<n+k; i++)
{
for (ll j=0; j<cnt[i]; j++) WriteAdvice(1);
WriteAdvice(0);
}
for (ll i=0; i<n; i++)
{
for (ll j=0; j<cnt[i]; j++) WriteAdvice(1);
WriteAdvice(0);
}
cout << "ruh" << endl;
}
assistant
#include "assistant.h"
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ld long double
using namespace std;
void Assist(unsigned char *a, int n, int k, int r)
{
ll ptr=0;
vector <ll> ok, cnt(k, 0), p(n, -1);
auto get=[&]()
{
ll ans=0;
while (a[ptr]==1) ans++, ptr++;
ptr++; return ans;
};
for (ll i=0; i<k; i++)
{
cnt[i]=get(), p[i]=i;
if (!cnt[i]) ok.pb(i);
}
for (ll i=0; i<n; i++)
{
ll cr=GetRequest();
cout << cr << endl;
if (p[cr]!=-1)
{
cnt[cr]--;
if (!cnt[cr]) ok.pb(cr);
}
else
{
ll id=ok.back(); ok.pop_back();
PutBack(id), p[cr]=id, cnt[id]=get();
if (!cnt[id]) ok.pb(id);
}
}
}
詳細信息
Subtask #1:
score: 0
Channel 2 Time Limit Exceeded
Test #1:
score: 0
Channel 2 Time Limit Exceeded
input:
4 2 65000 2 0 3 0
output:
1 1 0 0 0 0 0 0 ruh 2
input:
output:
result:
Subtask #2:
score: 0
Channel 2 Time Limit Exceeded
Test #12:
score: 0
Channel 2 Time Limit Exceeded
input:
10000 2000 2000000 5451 8333 6614 6013 8933 5291 4673 2423 1373 4369 6443 9253 4274 9813 1404 3960 7896 3621 5700 4193 4302 5955 7793 5650 5887 4827 8761 4162 3664 802 6193 1717 1760 677 1893 8480 486 5544 7521 8277 5347 5201 8364 596 1088 9041 9329 4868 3141 7279 5549 1111 754 55 8718 8854 7430 656...
output:
1 0 1 1 0 1 0 1 1 0 0 1 1 0 0 0 1 1 0 1 1 0 1 0 1 0 1 1 1 0 1 0 1 1 0 1 1 1 1 0 1 1 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 1 0 0 0 1 0 1 0 1 1 0 0 0 0 0 0 1 0 1 1 0 1 0 0 1 0 1 0 1 0 1 1 0 1 1 0 0 1 1 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 0 0 1 0 1 1 0 0 1 0 1 0 0 0 1 0 1 1 ...
input:
output:
result:
Subtask #3:
score: 0
Channel 2 Time Limit Exceeded
Test #22:
score: 0
Channel 2 Time Limit Exceeded
input:
80394 19021 1500000 72858 39151 63499 33072 48058 70885 51034 68453 51282 39279 36583 50232 45586 73715 50578 26059 67651 16908 63163 78449 68854 25125 72528 8350 19431 76913 65901 29633 11242 23714 51866 33698 53417 20066 74345 34798 46875 41956 13453 28693 52922 71783 11012 40345 61115 31634 34380...
output:
1 0 1 0 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 1 0 1 0 0 1 0 1 0 1 1 0 1 1 0 1 0 1 0 1 0 0 1 0 0 1 1 0 0 1 0 1 1 1 0 0 1 0 1 0 1 0 1 0 1 0 0 1 1 0 1 0 1 0 0 0 0 1 0 1 1 1 1 0 1 0 0 1 0 1 0 0 1 0 1 1 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 ...
input:
output:
result:
Subtask #4:
score: 0
Channel 2 Time Limit Exceeded
Test #32:
score: 0
Channel 2 Time Limit Exceeded
input:
4000 1192 10000 725 88 662 2834 3439 2402 52 606 1033 2124 2600 115 3859 2953 100 2209 2353 641 3833 1247 1971 3330 3754 1100 1734 2009 3397 1326 3455 3636 3203 3327 2403 1914 2815 850 2597 1969 2966 1382 2183 278 793 313 2368 2821 1158 3655 1454 442 2858 716 1115 3263 663 3497 2035 2102 1074 3319 1...
output:
0 1 1 1 1 0 1 1 0 1 0 0 1 1 1 0 0 1 1 0 0 1 0 0 0 1 1 0 1 1 0 0 1 1 0 1 0 0 1 1 0 1 0 0 1 1 1 0 0 0 0 1 0 1 1 0 1 1 0 1 0 1 0 1 1 1 0 0 1 0 1 0 0 1 0 1 0 0 0 1 0 0 1 1 0 1 0 1 0 0 1 0 1 1 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1 1 1 0 0 0 0 1 1 1 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 0 1 0 0 1 1 1 0 0 1 1 0 1 1 0 ...
input:
output:
result:
Subtask #5:
score: 0
Channel 2 Time Limit Exceeded
Test #42:
score: 0
Channel 2 Time Limit Exceeded
input:
100000 20000 1800000 21950 25220 44873 58672 9201 82569 27154 3312 82627 39771 91142 63204 25601 99930 17095 56663 30188 5056 9784 62200 19645 67214 53098 39607 83027 93403 1986 19889 23908 33429 29687 58256 98136 67907 18950 50288 33509 12296 17883 61477 14065 14037 29485 46063 18544 64149 52349 21...
output:
1 0 1 1 0 0 0 0 1 0 1 1 0 1 0 1 1 0 0 0 1 1 0 1 1 1 0 1 0 0 1 0 1 1 0 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 1 0 1 0 1 1 0 1 0 1 0 1 1 0 1 0 1 1 1 0 1 0 1 1 1 0 0 1 0 1 0 0 1 0 1 0 1 1 0 0 1 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 0 1 1 1 0 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 1 1 0 1 0 0 1 1 0 0 1 1 1 1 1 0 0 1 1 1 0 1 1 1 ...