QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#962612 | #7565. Harumachi Kaze | bunH2O | Compile Error | / | / | C++14 | 4.2kb | 2025-04-02 22:15:52 | 2025-04-02 22:15:52 |
Judging History
This is the latest submission verdict.
- [2025-04-02 22:15:52]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-04-02 22:15:52]
- Submitted
answer
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<cmath>
#include<ctime>
#include<cassert>
using namespace std;
typedef __int128 ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
const ll inf=9e18;
const ll mod=1e9+87;
inline ll read()
{
// ll x=0,f=1;
// char ch=getchar();
// while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
// while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
// return x*f;
ll x;cin>>x;return x;
}
inline char getc()
{
char ch=getchar();
while(ch!='0'&&ch!='1'){ch=getchar();}
return ch;
}
ll add(ll x,ll y)
{
if(x<0)return y;
if(y<0)return x;
cout<<"A "<<x<<' '<<y<<endl;
ll r;cin>>r;return r;
}
bool cmp(ll x,ll y)
{
assert(x>=0&&y>=0);
cout<<"C "<<x<<' '<<y<<endl;
ll p;cin>>p;return (p!=y);
}
ll n,q,B,m;
ll a[100005],b[100005];
ll qtp[100005],qt[100005],qpos[100005],qx[100005];
ll lg2[100005],id[100005][21][2];
struct node
{
ll ls,rs,x;
}tree[800005];
ll cntn=2;
void pushup(ll rt)
{
ll ls=tree[rt].ls,rs=tree[rt].rs;
if(tree[ls].x<0)tree[rt].x=tree[rs].x;
else if(tree[rs].x<0)tree[rt].x=tree[ls].x;
else tree[rt].x=add(tree[ls].x,tree[rs].x);
}
void build(ll rt,ll l,ll r,bool tp)
{
id[l][lg2[r-l+1]][tp]=rt;
if(l==r)
{
tree[rt].x=(l<=n?(!tp?a[l]:b[l]):-1);
return;
}
ll mid=(l+r)>>1;
tree[rt].ls=(++cntn),tree[rt].rs=(++cntn);
build(tree[rt].ls,l,mid,tp),build(tree[rt].rs,mid+1,r,tp);
// cout<<rt<<' '<<l<<' '<<r<<' '<<tree[rt].x<<'\n';
pushup(rt);
}
void upd(ll rt,ll l,ll r,ll pos,ll x)
{
if(l==r)
{
tree[rt].x=x;
return;
}
ll mid=(l+r)>>1,ls=tree[rt].ls,rs=tree[rt].rs;
if(pos<=mid)upd(ls,l,mid,pos,x);
if(mid+1<=pos)upd(rs,mid+1,r,pos,x);
pushup(rt);
}
unsigned long long res[100005],cntr;
void solve()
{
n=read(),q=read(),B=read();
for(int i=1;i<=n;i++)a[i]=read();
for(int i=1;i<=n;i++)b[i]=read();
for(int i=1;i<=q;i++)
{
qtp[i]=read();
if(qtp[i]==1)qt[i]=read(),qpos[i]=read(),qx[i]=read();
else qx[i]=read();
}
m=16384;
lg2[0]=-1;for(int i=1;i<=m;i++)lg2[i]=lg2[i>>1]+1;
build(1,1,m,0),build(2,1,m,1);
for(int i=1;i<=q;i++)
{
ll op=qtp[i];
if(op==1)
{
ll t=qt[i],pos=qpos[i],x=qx[i];
upd(t,1,m,pos,x);
}
if(op==2)
{
cntr++;
ll k=qx[i]-1,pa=0,pb=0,ida=-1,idb=-1;
while(k)
{
if(pa==n||pb==n)break;
ll p=lg2[(k+1)/2],rida=0,ridb=0;
if(pa+(1<<p)<=n)rida=add(ida,tree[id[pa+1][p][0]].x);
else rida=1;
if(pb+(1<<p)<=n)ridb=add(idb,tree[id[pb+1][p][1]].x);
else ridb=2;
bool ok=cmp(rida,ridb);
if(ok)ida=rida,k-=min(n-pa,(1ll<<p)),pa=min(pa+(1<<p),n);
else idb=ridb,k-=min(n-pb,(1ll<<p)),pb=min(pb+(1<<p),n);
}
if(pa==n)
{
k++;
for(int j=20;j>=0;j--)
{
if((1<<j)&k)idb=add(idb,tree[id[pb+1][j][1]].x),pb+=(1<<j);
}
res[cntr]=idb;
continue;
}
if(pb==n)
{
k++;
for(int j=20;j>=0;j--)
{
if((1<<j)&k)ida=add(ida,tree[id[pa+1][j][0]].x),pa+=(1<<j);
}
res[cntr]=ida;
continue;
}
ida=add(ida,tree[id[pa+1][0][0]].x),idb=add(idb,tree[id[pb+1][0][1]].x);
if(cmp(ida,idb))res[cntr]=ida;
else res[cntr]=idb;
}
}
cout<<"! "<<cntr<<endl;
for(int i=1;i<=cntr;i++)cout<<res[i]<<' ';cout<<endl;
}
int main()
{
// freopen("prob.in","r",stdin);
// freopen("prob1.out","w",stdout);
clock_t start=clock();
ll c=0,t=1;
while(t--)solve();
clock_t end=clock();
// cerr<<(end-start)*1.00/CLOCKS_PER_SEC<<'\n';
return 0;
}
Details
answer.code: In function ‘ll read()’: answer.code:23:13: error: no match for ‘operator>>’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘ll’ {aka ‘__int128’}) 23 | ll x;cin>>x;return x; | ~~~^~~ | | | | | ll {aka __int128} | std::istream {aka std::basic_istream<char>} In file included from /usr/include/c++/14/iostream:42, from answer.code:1: /usr/include/c++/14/istream:170:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 170 | operator>>(bool& __n) | ^~~~~~~~ /usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed: answer.code:23:15: error: cannot bind non-const lvalue reference of type ‘bool&’ to a value of type ‘ll’ {aka ‘__int128’} 23 | ll x;cin>>x;return x; | ^ /usr/include/c++/14/istream:174:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]’ (near match) 174 | operator>>(short& __n); | ^~~~~~~~ /usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed: answer.code:23:15: error: cannot bind non-const lvalue reference of type ‘short int&’ to a value of type ‘ll’ {aka ‘__int128’} 23 | ll x;cin>>x;return x; | ^ /usr/include/c++/14/istream:177:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 177 | operator>>(unsigned short& __n) | ^~~~~~~~ /usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed: answer.code:23:15: error: cannot bind non-const lvalue reference of type ‘short unsigned int&’ to a value of type ‘ll’ {aka ‘__int128’} 23 | ll x;cin>>x;return x; | ^ /usr/include/c++/14/istream:181:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]’ (near match) 181 | operator>>(int& __n); | ^~~~~~~~ /usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed: answer.code:23:15: error: cannot bind non-const lvalue reference of type ‘int&’ to a value of type ‘ll’ {aka ‘__int128’} 23 | ll x;cin>>x;return x; | ^ /usr/include/c++/14/istream:184:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 184 | operator>>(unsigned int& __n) | ^~~~~~~~ /usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed: answer.code:23:15: error: cannot bind non-const lvalue reference of type ‘unsigned int&’ to a value of type ‘ll’ {aka ‘__int128’} 23 | ll x;cin>>x;return x; | ^ /usr/include/c++/14/istream:188:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed: answer.code:23:15: error: cannot bind non-const lvalue reference of type ‘long int&’ to a value of type ‘ll’ {aka ‘__int128’} 23 | ll x;cin>>x;return x; | ^ /usr/include/c++/14/istream:192:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed: answer.code:23:15: error: cannot bind non-const lvalue reference of type ‘long unsigned int&’ to a value of type ‘ll’ {aka ‘__int128’} 23 | ll x;cin>>x;return x; | ^ /usr/include/c++/14/istream:197:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 197 | operator>>(long long& __n) | ...