# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
639534 | Benmath | Inside information (BOI21_servers) | C++14 | 213 ms | 11536 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int bo[120001];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,k;
cin>>n>>k;
int brojac=1;
vector<pair<int,int> > adjl[n+2];
for(int k1=0;k1<(n+k-1);k1++){
char l;
cin>>l;
if(l=='S'){
int x,y;
cin>>x>>y;
if(x==1){
bo[y]++;
}
if(y==1){
bo[x]++;
}
adjl[x].push_back({y,brojac});
adjl[y].push_back({x,brojac});
brojac++;
}else if (l=='Q'){
int y,x;
cin>>y>>x;
if(x==1){
if(bo[y]>0){
cout<<"yes"<<endl;
}else{
cout<<"no"<<endl;
}
}else if(y==1){
if(adjl[x].size()>0){
cout<<"yes"<<endl;
}else{
cout<<"no"<<endl;
}
}else{
if(adjl[x].size()>0 and adjl[y].size()>0){
int r1=adjl[x][0].second;
int r2=adjl[y][0].second;
if(r1<r2){
cout<<"yes"<<endl;
}else{
cout<<"no"<<endl;
}
}else{
cout<<"no"<<endl;
}
}
}else{
int x;
cin>>x;
int ans=0;
if(x==1){
cout<<brojac<<endl;
}else{
if(adjl[x].size()>0){
int r1=adjl[x][0].second;
cout<<brojac-r1+1<<endl;
}else{
cout<<1<<endl;
}
}
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |