답안 #773718

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
773718 2023-07-05T07:58:30 Z gagik_2007 송금 (JOI19_remittance) C++17
0 / 100
1000 ms 21956 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;
map<vector<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(vector<ll>p){
    if(p==b){
        cout<<"Yes"<<endl;
        exit(0);
    }
    if(used[p])return;
    used[p]=true;
    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(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);
    }
    recurs(a);
    cout<<"No"<<endl;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 308 ms 8548 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 224 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 11 ms 832 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 3 ms 468 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 2 ms 428 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 9 ms 884 KB Output is correct
19 Correct 2 ms 468 KB Output is correct
20 Correct 5 ms 540 KB Output is correct
21 Execution timed out 1077 ms 21956 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 308 ms 8548 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 224 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 11 ms 832 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 3 ms 468 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 2 ms 428 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 9 ms 884 KB Output is correct
19 Correct 2 ms 468 KB Output is correct
20 Correct 5 ms 540 KB Output is correct
21 Execution timed out 1077 ms 21956 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 308 ms 8548 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 224 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 11 ms 832 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 3 ms 468 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 2 ms 428 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 9 ms 884 KB Output is correct
19 Correct 2 ms 468 KB Output is correct
20 Correct 5 ms 540 KB Output is correct
21 Execution timed out 1077 ms 21956 KB Time limit exceeded
22 Halted 0 ms 0 KB -