結果

問題 No.474 色塗り2
ユーザー vjudge1
提出日時 2025-06-28 16:44:31
言語 C++17(gcc12)
(gcc 12.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,262 bytes
コンパイル時間 4,588 ms
コンパイル使用メモリ 212,732 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-06-28 16:44:39
合計ジャッジ時間 6,372 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 WA * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

void FileIO(){
    freopen("color.in","r",stdin);
    freopen("color.out","w",stdout);
}

namespace sunburstfan{
    int mod2(int c,int k){
        if(k==0) return 1; 
        if(c==0) return 0;
        return (c&1);   
    }
    
    vector<int> get(int n){
        vector<int> divs;
        for(int i=1;i*i<=n;i++){
            if(n%i==0){
                divs.push_back(i);
                if(i!=n/i){
                    divs.push_back(n/i);
                }
            }
        }
        return divs;
    }

    void solve(){
        int a,b,c;
        cin>>a>>b>>c;
        
        vector<int> div_a=get(a);
        vector<int> div_b=get(b);
        
        int res=0;
        for(auto i:div_a){
            int g=a/i;
            for(auto j:div_b){
                int h=b/j;
                int w=1;
                w=(w*(c&1))&1;   
                w=(w*mod2(c,g))&1; 
                w=(w*mod2(c,g*h))&1;   
                res=(res+w)&1;
            }
        }
        cout<<res<<"\n";
    }
}

using namespace sunburstfan;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    //FileIO();

    int T;
    cin>>T;
    while(T--){
        solve();
    }
    
    return 0;
}
0