답안 #773710

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
773710 2023-07-05T07:56:18 Z gagik_2007 송금 (JOI19_remittance) C++17
0 / 100
468 ms 11856 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef pair<ll, ll> pll;

#define ff first
#define ss second

ll ttt;
const ll INF=1e18;
const ll MOD=1e9+7;
const ll N=3e5+7;
ll n,m,k;
vector<ll>a,b;
unordered_map<ll,bool>used;
ll verjval;
const ll MAXVAL=18;

ll value(const vector<ll>& p){
    ll cur=1;
    ll res=0;
    for(ll x:p){
        res+=cur*x;
        cur*=MAXVAL;
    }
    return res;
}

vector<ll> deval(ll val){
    vector<ll>ans;
    for(int _=0;_<n;_++){
        ans.push_back(val%MAXVAL);
        val/=MAXVAL;
    }
    return ans;
}

void recurs(ll val){
    if(val==verjval){
        cout<<"Yes"<<endl;
        exit(0);
    }
    if(used[val])return;
    used[val]=true;
    vector<ll>p=deval(val);
    for(ll i=0;i<n;i++){
        for(ll j=0;j<n;j++){
            if(i!=j){
                ll t1=p[i];
                ll t2=p[j];
                for(ll vl=1;vl<=p[i]/2;vl++){
                    p[i]-=2*vl;
                    p[j]+=vl;
                    recurs(value(p));
                    p[i]=t1;
                    p[j]=t2;
                }
            }
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    // freopen("output.txt","w",stdout);
    cin>>n;
    for(ll i=0;i<n;i++){
        ll x,y;
        cin>>x>>y;
        a.push_back(x);
        b.push_back(y);
    }
    verjval=value(b);
    recurs(value(a));
    cout<<"No"<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 2776 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 2 ms 468 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 468 ms 11856 KB Output is correct
22 Correct 7 ms 852 KB Output is correct
23 Correct 206 ms 6628 KB Output is correct
24 Correct 2 ms 468 KB Output is correct
25 Incorrect 1 ms 340 KB Output isn't correct
26 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 2776 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 2 ms 468 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 468 ms 11856 KB Output is correct
22 Correct 7 ms 852 KB Output is correct
23 Correct 206 ms 6628 KB Output is correct
24 Correct 2 ms 468 KB Output is correct
25 Incorrect 1 ms 340 KB Output isn't correct
26 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 2776 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 2 ms 468 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 468 ms 11856 KB Output is correct
22 Correct 7 ms 852 KB Output is correct
23 Correct 206 ms 6628 KB Output is correct
24 Correct 2 ms 468 KB Output is correct
25 Incorrect 1 ms 340 KB Output isn't correct
26 Halted 0 ms 0 KB -