답안 #103744

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
103744 2019-04-02T11:55:44 Z gs18115 동전 게임 (KOI15_coin) C++14
100 / 100
43 ms 1312 KB
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long LL;
typedef pair<LL,LL>PL;
const LL INF=1e18;
LL K,T,A,B;
bool f;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin>>K;
    cin>>T;
    while(T-->0)
    {
        cin>>A>>B;
        if(A>K||B>K)
            f=false;
        else if(A>B)
        {
            if(K-A+2<A-B)
                f=false;
            else
                f=true;
        }
        else
        {
            if(K-B+1<B-A)
                f=false;
            else
                f=true;
        }
        cout<<(f?1:0)<<'\n';
    }
    cout<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 428 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 5 ms 392 KB Output is correct
4 Correct 26 ms 896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 17 ms 888 KB Output is correct
4 Correct 20 ms 1024 KB Output is correct
5 Correct 43 ms 1272 KB Output is correct
6 Correct 23 ms 1280 KB Output is correct
7 Correct 22 ms 1152 KB Output is correct
8 Correct 24 ms 1312 KB Output is correct