답안 #802787

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
802787 2023-08-02T14:27:07 Z Darren0724 Chess Rush (CEOI20_chessrush) C++17
0 / 100
0 ms 220 KB
#pragma GCC optimize("Ofast","O3","unroll-loops")
#pragma GCC target("avx2")
#include<bits/stdc++.h>
using namespace std;
#define double long double
#define int long long
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define rz resize
#define pb emplace_back
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)
#define ACorz ios_base::sync_with_stdio(false);cin.tie(0);
#define endl '\n'
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int INF=1e9,INF2=2e9;
const int mod=1e9+7;
const int mod1=998244353;
const int N=1000005;
const int K=45000;
const int M=5000;
int n,m;
void P(int a,int b){
    if(a==b){
        cout<<n-1<<' '<<1<<endl;
    }
    else{
        cout<<0<<' '<<0<<endl;
    }
}
void R(int a,int b){
    if(a==b){
        cout<<1<<' '<<1<<endl;
    }
    else{
        cout<<2<<' '<<2<<endl;
    }
}
void Q(int a,int b){
    if(a==b||a+n==b+1||a+1==b+n){
        cout<<1<<' '<<1<<endl;
        return;
    }
    int ans=0;
    if(b<a){
        swap(a,b);
    }
    // R RU U LU L
    //R
    ans++;
    if(b+n-1<=m)ans++;
    if((b-n+1)>a)ans++;
    //RU
    if(a+n<=m+1)ans++;
    ans++;
    if((b-a+n-1)%2==0){
        int pos=(b-a+n-1)/2;
        if(pos>b&&pos<=m)ans++;
    }
    //U
    if((b-a)<=n-1)ans++;
    ans++;
    //LU
    if((a-n+1)>=1)ans++;
    if((a-b+n-1)%2==0){
        int pos=(a-b+n-1)/2;
        if(pos>=1&&pos<a)ans++;
    }
    //L
    if((b-n+1)>=1)ans++;
    cout<<2<<' '<<ans<<endl;

}
signed main(){
    ACorz;
    int q;
    cin>>n>>m>>q;    
    for(int i=0;i<q;i++){
        char c;int a,b;cin>>c>>a>>b;
        if(c=='R')R(a,b);
        if(c=='Q')Q(a,b);
        if(c=='P')P(a,b);
    }
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 220 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 220 KB Output isn't correct
2 Halted 0 ms 0 KB -