제출 #1200701

#제출 시각아이디문제언어결과실행 시간메모리
1200701MighilonMagic Show (APIO24_show)C++20
0 / 100
0 ms336 KiB
#include <bits/stdc++.h>
using namespace std;
 
#ifdef DEBUG
#include "../Library/debug.h"
#else
#include "Alice.h"
#define dbg(x...)
#endif

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl; 
 
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) for (int i = 0; i < (a); ++i)
#define FORd(i, a, b) for (int i = (b) - 1; i >= (a); --i)
#define F0Rd(i, a) for (int i = (a) - 1; i >= 0; --i)
#define trav(a, x) for (auto& a : x)
#define f first 
#define s second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
 
const char nl = '\n';
const int INF = 1e9;
const ll MOD = 998244353;
const int mxN = 3e5+5;


vpi Alice(){
    int n = 1000;
    ll x = setN(n);
    vpi res;
    FOR(i,2,n+1){
        res.pb({(x%(i-1))+1,i});
    }
    return res;
}
#include <bits/stdc++.h>
using namespace std;
 
#ifdef DEBUG
#include "../Library/debug.h"
#else
#include "Bob.h"
#define dbg(x...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl; 
 
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define F0R(i, a) for (int i = 0; i < (a); ++i)
#define FORd(i, a, b) for (int i = (b) - 1; i >= (a); --i)
#define F0Rd(i, a) for (int i = (a) - 1; i >= 0; --i)
#define trav(a, x) for (auto& a : x)
#define f first 
#define s second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
 
const char nl = '\n';
const int INF = 1e9;
const int MOD = 1e9 + 7;

ll ex_gcd(ll a,ll b,ll& x,ll& y){
    if(b==0){
        x=1;
        b=0;
        return a;
    }
    ll x1,y1;
    ll d=ex_gcd(b,a%b,x1,y1);
    x=y1;
    y=x1-a/b*y1;
    return d;
}

ll Bob(vpi v){
    ll num[19];
    num[0]=1;
    F0R(i,18) num[i+1]=num[i]*10;
    auto check=[&](ll a, ll b){
        int x=0,y=0;
        F0R(i,19)if(a<num[i]){
            x=i;
            break;
        }
        if(a&&!x) x=19;
        if(b&&!y) y=19;
        F0R(i,19)if(b<num[i]){
            y=i;
            break;
        }
        return (x+y)<=20;
    };
    ll res=0;
    ll m=1;
    trav(i,v){
        ll x, y,d;
        d=ex_gcd(m,i.s,x,y);
        if(!check(m,i.s))
            return res;
        res = res+(i.f-res)/d*x%(i.s/d)*m;
        m = m/d*i.s;
        res%=m;
        if(res<0)res+=m;
    }
}
 

컴파일 시 표준 에러 (stderr) 메시지

# 2번째 컴파일 단계

Bob.cpp: In function 'll Bob(vpi)':
Bob.cpp:79:1: warning: control reaches end of non-void function [-Wreturn-type]
   79 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...