답안 #964112

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
964112 2024-04-16T10:38:26 Z Darren0724 Chess Rush (CEOI20_chessrush) C++17
8 / 100
1 ms 348 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)swap(a,b);
    if(a==b||(n==m&&a==1&&b==m)){
        cout<<1<<' '<<1<<endl;
        return;
    }
    int ans=4;
    if(m==n&&(a==1||b==n))ans++;
    int k=(n-1-b+a);
    if(k%2==0){
        if(a-k/2>=1)ans++;
        if(b+k/2<=m)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 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -