QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#337206 | #7942. $K$ Subsequences | Days_of_Future_Past# | Compile Error | / | / | C++11 | 1.0kb | 2024-02-25 08:15:49 | 2024-02-25 08:15:51 |
Judging History
answer
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
int ans[210000];
set<pair<int,int> > S;
int n,k;
int main()
{
int T; cin>>T;
while (T--)
{
scanf("%d%d",&n,&k);
S.clear();
rep(i,k)S.insert(mp(0,i));
rep(i,n)
{
int x; scanf("%d",&x);
if (x==1)
{
auto t=*S.begin(); S.erase(t);
t.first++;
S.insert(t);
ans[i]=t.second;
}
else
{
auto p=S.end(); p--;
auto t=*p; S.erase(t);
t.first=max(0,t.first-1);
S.insert(t);
ans[i]=t.second;
}
}
rep(i,n)printf("%d%c",ans[i],i==n?'\n':' ');
}
return 0;
}
Details
answer.code: In function ‘int main()’: answer.code:17:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 17 | scanf("%d%d",&n,&k); | ~~~~~^~~~~~~~~~~~~~ answer.code:22:25: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 22 | int x; scanf("%d",&x); | ~~~~~^~~~~~~~~ In file included from /usr/include/c++/13/string:43, from /usr/include/c++/13/bitset:52, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52, from answer.code:4: /usr/include/c++/13/bits/allocator.h: In destructor ‘std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int> >, std::less<std::pair<int, int> >, std::allocator<std::pair<int, int> > >::_Rb_tree_impl<std::less<std::pair<int, int> >, true>::~_Rb_tree_impl()’: /usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = std::_Rb_tree_node<std::pair<int, int> >]’: target specific option mismatch 184 | ~allocator() _GLIBCXX_NOTHROW { } | ^ In file included from /usr/include/c++/13/map:62, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:152: /usr/include/c++/13/bits/stl_tree.h:662:16: note: called from here 662 | struct _Rb_tree_impl | ^~~~~~~~~~~~~