답안 #1024871

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1024871 2024-07-16T11:34:34 Z Malix 자동 인형 (IOI18_doll) C++14
16 / 100
52 ms 12640 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pi;
typedef vector<pi> pii;
typedef tuple<int,int,int> tii;

#define REP(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define LSOne(s) ((s)&(-s))

ll INF=1e18+10;
int inf=1e9+10;
ll M=1e9+7;

void create_circuit(int M, std::vector<int> A) {
  int n=A.size();
  vi c,x,y;
  vi a(M+1,0);
  vii b(M+1);
  REP(i,0,n)a[A[i]]++;
  REP(i,0,n-1)b[A[i]].PB(A[i+1]);
  b[A[n-1]].PB(0);
  c.resize(M+1,0);
  c[0]=A[0];
  int k=0;
  REP(i,1,M+1){
    if(a[i]==0)continue;
    if(a[i]==1)c[i]=b[i][0];
    else if(a[i]==2){
      c[i]=k-1;
      k--;
      x.PB(b[i][0]);
      y.PB(b[i][1]);
    }
    else if(a[i]==3){
      c[i]=k-1;
      k--;
      x.PB(k-1);
      y.PB(k-2);
      x.PB(k);
      y.PB(b[i][1]);
      x.PB(b[i][0]);
      y.PB(b[i][2]);
      k-=2;
    }
    else{
      c[i]=k-1;
      k--;
      x.PB(k-1);
      y.PB(k-2);
      x.PB(b[i][0]);
      y.PB(b[i][2]);
      x.PB(b[i][1]);
      y.PB(b[i][3]);
      k-=2;
    }
  }
  // for(auto u:c)cerr<<u<<" ";
  // cerr<<"\n";
  // for(auto u:x)cerr<<u<<" ";
  // cerr<<"\n";
  // for(auto u:y)cerr<<u<<" ";
  // cerr<<"\n";
  answer(c,x,y);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 17 ms 7260 KB Output is correct
3 Correct 14 ms 5936 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 6 ms 4184 KB Output is correct
6 Correct 25 ms 8576 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 17 ms 7260 KB Output is correct
3 Correct 14 ms 5936 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 6 ms 4184 KB Output is correct
6 Correct 25 ms 8576 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 30 ms 8404 KB Output is correct
9 Correct 33 ms 9944 KB Output is correct
10 Correct 45 ms 12640 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 17 ms 7260 KB Output is correct
3 Correct 14 ms 5936 KB Output is correct
4 Correct 0 ms 436 KB Output is correct
5 Correct 6 ms 4184 KB Output is correct
6 Correct 25 ms 8576 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 30 ms 8404 KB Output is correct
9 Correct 33 ms 9944 KB Output is correct
10 Correct 45 ms 12640 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 400 KB Output is correct
14 Correct 52 ms 12220 KB Output is correct
15 Correct 29 ms 6864 KB Output is correct
16 Correct 49 ms 9920 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 47 ms 11968 KB Output is correct
21 Correct 0 ms 344 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 604 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -