Submission #1112305

# Submission time Handle Problem Language Result Execution time Memory
1112305 2024-11-14T03:37:38 Z thelegendary08 Mechanical Doll (IOI18_doll) C++17
16 / 100
71 ms 13500 KB
#include "doll.h"
#include<bits/stdc++.h>
#define vi vector<int>
#define pb push_back
#define vvi vector<vector<int>>
#define f0r(i,n) for(int i = 0; i<n; i++)
using namespace std;
void create_circuit(int M, std::vector<int> A) {
	vi v;
	v.pb(0);
	for(auto u : A)v.pb(u);
	v.pb(0);
	vvi nxt(M+1);
	f0r(i, v.size() - 1){
		nxt[v[i]].pb(v[i+1]);
	}
	int num = -1;
	vi c(M+1);
	vi x;
	vi y;
	f0r(i, M+1){
		if(nxt[i].size() == 1){
			c[i] = nxt[i][0];
		}
		else if(nxt[i].size() == 2){
			c[i] = num;
			x.pb(nxt[i][0]);
			y.pb(nxt[i][1]);
			num--;
		}
		else if(nxt[i].size() == 3){
			c[i] = num;
			x.pb(num-1);
			y.pb(num - 2);
			num--;
			x.pb(nxt[i][0]);
			y.pb(nxt[i][1]);
			num--;
			x.pb(c[i]);
			y.pb(nxt[i][2]);
			num--;
		}
		else if(nxt[i].size() == 4){
			c[i] = num;
			x.pb(num-1);
			y.pb(num - 2);
			num--;
			x.pb(nxt[i][0]);
			y.pb(nxt[i][2]);
			num--;
			x.pb(nxt[i][1]);
			y.pb(nxt[i][3]);
			num--;
		}
	}
	
	answer(c,x,y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:6:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 | #define f0r(i,n) for(int i = 0; i<n; i++)
......
   14 |  f0r(i, v.size() - 1){
      |      ~~~~~~~~~~~~~~~              
doll.cpp:14:2: note: in expansion of macro 'f0r'
   14 |  f0r(i, v.size() - 1){
      |  ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 19 ms 6632 KB Output is correct
3 Correct 16 ms 5576 KB Output is correct
4 Correct 1 ms 508 KB Output is correct
5 Correct 7 ms 3920 KB Output is correct
6 Correct 26 ms 8136 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 19 ms 6632 KB Output is correct
3 Correct 16 ms 5576 KB Output is correct
4 Correct 1 ms 508 KB Output is correct
5 Correct 7 ms 3920 KB Output is correct
6 Correct 26 ms 8136 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 34 ms 7876 KB Output is correct
9 Correct 43 ms 10044 KB Output is correct
10 Correct 70 ms 13500 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 444 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 19 ms 6632 KB Output is correct
3 Correct 16 ms 5576 KB Output is correct
4 Correct 1 ms 508 KB Output is correct
5 Correct 7 ms 3920 KB Output is correct
6 Correct 26 ms 8136 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
8 Correct 34 ms 7876 KB Output is correct
9 Correct 43 ms 10044 KB Output is correct
10 Correct 70 ms 13500 KB Output is correct
11 Correct 1 ms 336 KB Output is correct
12 Correct 1 ms 336 KB Output is correct
13 Correct 1 ms 444 KB Output is correct
14 Correct 71 ms 13288 KB Output is correct
15 Correct 32 ms 7620 KB Output is correct
16 Correct 49 ms 11252 KB Output is correct
17 Correct 1 ms 504 KB Output is correct
18 Correct 1 ms 336 KB Output is correct
19 Correct 1 ms 336 KB Output is correct
20 Correct 64 ms 12932 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB wrong motion
2 Halted 0 ms 0 KB -