hiho week 97 register

Ended

Participants:296

Verdict:Accepted
Score:100 / 100
Submitted:2016-05-10 21:09:32

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <utility>
#define ff first
#define ss second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
const int INF=1e9+250;
LL mod=1e9+7;
const int N=100005;
void exgcd(LL a,LL b,LL &d,LL &x,LL &y){
    if(!b){x=1;y=0;d=a;return;}
    else {exgcd(b,a%b,d,y,x);y-=a/b*x;}
}
vector<int> g1,g2;
LL solve(){ //x=g2[i](mod g1[i])
    LL ta=g1[0],tb=g2[0];
    int flag=1;
    for(int i=1;i<g1.size();i++){
        LL xa=ta,xb=g1[i],c=g2[i]-tb,d,x,y;
        exgcd(xa,xb,d,x,y);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX