結果
問題 | No.1061 素敵な数列 |
ユーザー | Enjapma_kyopro |
提出日時 | 2020-05-16 13:56:46 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 5,245 bytes |
コンパイル時間 | 1,729 ms |
コンパイル使用メモリ | 175,536 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-10-02 11:45:37 |
合計ジャッジ時間 | 8,552 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 1 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | AC | 1 ms
5,248 KB |
testcase_05 | AC | 2 ms
5,248 KB |
testcase_06 | RE | - |
testcase_07 | AC | 2 ms
5,248 KB |
testcase_08 | AC | 2 ms
5,248 KB |
testcase_09 | AC | 2 ms
5,248 KB |
testcase_10 | AC | 2 ms
5,248 KB |
testcase_11 | AC | 2 ms
5,248 KB |
testcase_12 | AC | 2 ms
5,248 KB |
testcase_13 | AC | 2 ms
5,248 KB |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | AC | 2 ms
5,248 KB |
testcase_17 | AC | 2 ms
5,248 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
ソースコード
#include <bits/stdc++.h> #include <unistd.h> #include <sys/time.h> #include <stdlib.h> using namespace std; typedef long long ll; typedef pair<ll,ll> P; typedef pair<P, ll> T; long long int INF = 2e18; const ll fact_table = 1200008; double Pi = 3.1415926535897932384626; priority_queue <ll> pql; priority_queue <P> pqp; priority_queue <P> bag; //big priority queue priority_queue <ll,vector<ll>,greater<ll> > pqls; priority_queue <P,vector<P>,greater<P> > pqps; //small priority queue //top pop ll dx[8]={1,0,-1,0,1,1,-1,-1}; ll dy[8]={0,1,0,-1,1,-1,-1,1}; char dir[] = "DRUL"; //↓,→,↑,← #define endl "\n" #ifdef ENJAPMA #undef endl #endif #define p(x) cout<<x<<endl; #define el cout<<endl; #define pe(x) cout<<x<<" "; #define ps(x) cout<<fixed<<setprecision(25)<<x<<endl; #define pu(x) cout<<(x); #define pb push_back #define lb lower_bound #define ub upper_bound #define CLEAR(a) a = decltype(a)(); #define pc(x) cout << x << ","; const ll mod = 998244353ll; // const ll mod = 1000000007ll; ll mypow(ll number1,ll number2, ll mod){ if(number2 == 0){ return 1ll; }else{ ll number3 = mypow(number1,number2 / 2, mod); number3 *= number3; number3 %= mod; if(number2%2==1){ number3 *= number1; number3 %= mod; } return number3; } } void YES(bool condition){ if(condition){ p("YES"); }else{ p("NO"); } return; } void Yes(bool condition){ if(condition){ p("Yes"); }else{ p("No"); } return; } /* ll fact[fact_table + 5],rfact[fact_table + 5]; void c3_init(){ fact[0] = rfact[0] = 1; for(ll i=1; i<=fact_table; i++){ fact[i] = (fact[i-1]*i) % mod; } rfact[fact_table] = mypow(fact[fact_table],mod - 2, mod); for(ll i=fact_table; i>=1; i--){ rfact[i-1] = rfact[i] * i; rfact[i-1] %= mod; } return;} ll c3(ll n,ll r){ assert(n >= r); assert(n >= 0); assert(r >= 0); return (((fact[n] * rfact[r]) % mod ) * rfact[n-r]) % mod;} */ bool multicase = false; ll n,m,num,a,b,c,d,e,q; bool used[200005]; ll k; ll x[100005]; void paintN(ll maxi, ll l, ll r); void paintM(ll maxi, ll l, ll r); void paintN(ll maxi, ll l, ll r){ if(maxi <= 4){ // 埋め込み if(maxi == 0){ x[l] = x[l+1] = x[l+2] = 0; }else if(maxi == 1){ assert(false); }else if(maxi == 2){ x[l] = x[l+2] = x[l+6] = 2; x[l+1] = x[l+4] = x[l+7] = 0; x[l+3] = x[l+5] = x[l+8] = 1; }else if(maxi == 3){ x[l] = x[l+1] = x[l+5] = 3; x[l+2] = x[l+3] = x[l+6] = 2; x[l+4] = x[l+7] = x[l+11] = 1; x[l+8] = x[l+9] = x[l+10] = 0; }else if(maxi == 4){ x[l] = x[l+9] = x[l+14] = 4; x[l+1] = x[l+2] = x[l+6] = 3; x[l+3] = x[l+4] = x[l+7] = 2; x[l+5] = x[l+8] = x[l+10] = 1; x[l+11] = x[l+12] = x[l+13] = 0; } return; } if(maxi % 2 == 0){ ll idx = l; for(ll i=maxi;i>=maxi/2;i--){ x[idx++] = i; x[idx++] = i; } for(ll i=maxi;i>=maxi/2;i--){ x[idx++] = i; } paintN(maxi/2-1, idx, r); }else{ ll idx = l; for(ll i=maxi;i>=maxi/2+1;i--){ x[idx++] = i; x[idx++] = i; } x[idx++] = maxi/2; for(ll i=maxi;i>=maxi/2+1;i--){ x[idx++] = i; } x[idx++] = maxi/2; x[idx+1] = maxi/2; paintM(maxi/2-1, idx, r); } return; } void paintM(ll maxi, ll l, ll r){ if(maxi <= 2){ if(maxi == 0){ assert(false); }else if(maxi == 1){ x[l] = x[l+2] = x[l+3] = 1; }else if(maxi == 2){ x[l] = x[l+3] = x[l+6] = 0; x[l+2] = x[l+4] = x[l+7] = 1; x[l+5] = x[l+8] = x[l+9] = 2; } return; } if(maxi % 2 == 0){ ll idx = r - 1; for(ll i=maxi;i>=maxi/2;i--){ x[idx--] = i; } for(ll i=maxi;i>=maxi/2;i--){ x[idx--] = i; x[idx--] = i; } paintM(maxi/2-1, l, idx+1); }else{ vector<ll> v; for(ll i=maxi;i>=maxi/2+1;i--){ v.pb(i);v.pb(i); } v.pb(maxi/2); for(ll i=maxi;i>=maxi/2+1;i--){ v.pb(i); } v.pb(maxi/2); v.pb(0); v.pb(maxi/2); reverse(v.begin(), v.end()); for(ll i=l;i<l+v.size();i++){ if(v[i-l] != 0)x[i] = v[i-l]; } paintN(maxi/2-1, l+v.size(), r); } return; } void solve(){ cin >> n; if(n == 2){ p(-1); return; } paintN(n-1, 0, 3*n); for(ll i=0;i<3*n-1;i++){ cout << x[i] << " "; } cout << x[3*n-1] << endl; return; } int main(){ // init(); ios::sync_with_stdio(false); cin.tie(nullptr); ll q, testcase = 1; if(multicase){ cin >> q; }else{ q = 1; } while(q--){ // pu("Case ");pu("#");pu(testcase);pu(": "); solve(); testcase++; } // solve(); return 0; }