結果

問題 No.849 yuki国の分割統治
ユーザー ttttan2ttttan2
提出日時 2019-07-05 23:37:39
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,373 bytes
コンパイル時間 1,549 ms
コンパイル使用メモリ 172,556 KB
実行使用メモリ 11,776 KB
最終ジャッジ日時 2024-04-16 08:13:21
合計ジャッジ時間 3,863 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 WA -
testcase_08 AC 47 ms
8,448 KB
testcase_09 AC 46 ms
7,808 KB
testcase_10 AC 44 ms
7,168 KB
testcase_11 AC 42 ms
7,552 KB
testcase_12 AC 40 ms
6,944 KB
testcase_13 AC 49 ms
8,064 KB
testcase_14 AC 46 ms
7,552 KB
testcase_15 AC 45 ms
8,064 KB
testcase_16 AC 68 ms
10,496 KB
testcase_17 AC 37 ms
6,944 KB
testcase_18 AC 64 ms
10,752 KB
testcase_19 AC 45 ms
7,424 KB
testcase_20 AC 57 ms
9,344 KB
testcase_21 AC 29 ms
6,944 KB
testcase_22 AC 49 ms
9,216 KB
testcase_23 AC 47 ms
8,704 KB
testcase_24 AC 36 ms
7,040 KB
testcase_25 AC 72 ms
11,776 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 1 ms
6,940 KB
testcase_28 AC 2 ms
6,940 KB
testcase_29 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
//ios::sync_with_stdio(false);
//cin.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
double pi=2*acos(0);
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
ll n,k,m;
vector<ll> pri;
bool prijud(ll n){
    for(int i=2;i*i<=n;i++){
        if(n%i==0)return false;
    }
    return true;
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll a,b,c,d;cin>>a>>b>>c>>d;
    int n;cin>>n;
    ll x[n],y[n];
    rep(i,0,n)cin>>x[i]>>y[i];
    ll s[n],t[n];
    rep(i,0,n){
        s[i]=x[i]*d-y[i]*c;
        t[i]=y[i]*a-x[i]*b;
    }
    if(a*d==b*c){
        set<ll> st;
        rep(i,0,n){
            st.insert(b*x[i]-a*y[i]);
        }
        cout<<st.size()<<endl;
        return 0;
    }
    
    set<pll> st;
    rep(i,0,n){
        s[i]%=abs(a*d-b*c);
        t[i]%=abs(a*d-b*c);
        if(s[i]<0)s[i]+=abs(a*d-b*c);
        if(t[i]<0)t[i]+=abs(a*d-b*c);
        st.insert(make_pair(s[i],t[i]));
    }
    
    cout<<st.size()<<endl;
}

0