QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#54478 | #3308. Remote Control | AllenKING_RED | Compile Error | / | / | C++ | 2.2kb | 2022-10-08 21:44:22 | 2022-10-08 21:44:23 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-10-08 21:44:23]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-10-08 21:44:22]
- 提交
answer
#include<bits/stdc++.h>
using namespace std;
const int N=3e5+10;
int n,Q;
int nowx,nowy;
map<pair<int,int>,int>q;
string s;
struct mem{
int x;
int y;
}a[N],b[N];
int fa[N];
int find(int x)
{
if(fa[x]==x)return x;
return fa[x]=find(fa[x]);
}
int main(void)
{
ios::sync_with_studio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n;
cin>>s;
cin>>Q;
for(int i=1;i<=Q;i++)
{
cin>>a[i].x>>a[i].y;
b[i].x=a[i].x;
b[i].y=a[i].y;
fa[i]=i;
if(!q[make_pair(a[i].x,a[i].y)])
q[make_pair(a[i].x,a[i].y)]=i;
else
fa[i]=q[make_pair(a[i].x,a[i].y)];
}
for(int i=0;i<n;i++)
{
if(s[i]=='R')
nowx--;
else if(s[i]=='L')
nowx++;
else if(s[i]=='D')
nowy++;
else if(s[i]=='U')
nowy--;
if(q[make_pair(nowx,nowy)])
{
int num=q[make_pair(nowx,nowy)];
if(s[i]=='R')
{
b[num].x--;
if(!q[make_pair(nowx-1,nowy)])
{
q[make_pair(nowx-1,nowy)]=q[make_pair(nowx,nowy)];
q[make_pair(nowx,nowy)]=0;
}
else
{
fa[find(num)]=find(q[make_pair(nowx-1,nowy)]);
q[make_pair(nowx,nowy)]=0;
}
}
else if(s[i]=='L')
{
b[num].x++;
if(!q[make_pair(nowx+1,nowy)])
{
q[make_pair(nowx+1,nowy)]=q[make_pair(nowx,nowy)];
q[make_pair(nowx,nowy)]=0;
}
else
{
fa[find(num)]=find(q[make_pair(nowx+1,nowy)]);
q[make_pair(nowx,nowy)]=0;
}
}
else if(s[i]=='D')
{
b[num].y++;
if(!q[make_pair(nowx,nowy+1)])
{
q[make_pair(nowx,nowy+1)]=q[make_pair(nowx,nowy)];
q[make_pair(nowx,nowy)]=0;
}
else
{
fa[find(num)]=find(q[make_pair(nowx,nowy+1)]);
q[make_pair(nowx,nowy)]=0;
}
}
else if(s[i]=='U')
{
b[num].y--;
if(!q[make_pair(nowx,nowy-1)])
{
q[make_pair(nowx,nowy-1)]=q[make_pair(nowx,nowy)];
q[make_pair(nowx,nowy)]=0;
}
else
{
fa[find(num)]=find(q[make_pair(nowx,nowy-1)]);
q[make_pair(nowx,nowy)]=0;
}
}
}
}
for(int i=1;i<=Q;i++)
{
int nxt=find(i);
int x=0,y=0;
x=-(nowx-b[nxt].x);
y=-(nowy-b[nxt].y);
cout<<x<<" "<<y<<endl;
}
return 0;
}
详细
answer.code: In function ‘int main()’: answer.code:20:14: error: ‘sync_with_studio’ is not a member of ‘std::ios’ {aka ‘std::basic_ios<char>’} 20 | ios::sync_with_studio(false); | ^~~~~~~~~~~~~~~~