Submission #1045083

# Submission time Handle Problem Language Result Execution time Memory
1045083 2024-08-05T16:32:35 Z wood Mechanical Doll (IOI18_doll) C++17
6 / 100
39 ms 12196 KB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
void create_circuit(int M, std::vector<int> A) {
	int N = A.size();
	vector<int> adj[M];
	for(int i = 0; i<N; i++){
		if(i<N-1)
		adj[A[i]-1].pb(A[i+1]);
		else adj[A[i]-1].pb(0);
	}
	vector<int> res(M+1), x, y;
	bool done[M]; memset(done,0,sizeof done);
	int switchcnt = 0;
	res[0] = A[0];
	for(int i = 0; i<M; i++){
		if(done[i]) continue;
		done[i] = true;
		if(adj[i].size()==1) res[i+1] = adj[i][0];
		if(adj[i].size()==2){
			res[i+1] = -switchcnt-1;
			switchcnt++;
			x.pb(adj[i][0]);
			y.pb(adj[i][1]);
		}
	}
	answer(res,x,y);
}

Compilation message

In file included from /usr/include/string.h:495,
                 from /usr/include/c++/10/cstring:42,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:48,
                 from doll.cpp:2:
In function 'void* memset(void*, int, size_t)',
    inlined from 'void create_circuit(int, std::vector<int>)' at doll.cpp:14:22:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:71:33: warning: 'void* __builtin_memset(void*, int, long unsigned int)' specified bound 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
   71 |   return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
      |          ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 15 ms 6492 KB Output is correct
3 Correct 12 ms 5724 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 3996 KB Output is correct
6 Correct 18 ms 8540 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 15 ms 6492 KB Output is correct
3 Correct 12 ms 5724 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 3996 KB Output is correct
6 Correct 18 ms 8540 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 28 ms 7888 KB Output is correct
9 Correct 28 ms 9688 KB Output is correct
10 Correct 39 ms 12196 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 436 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 15 ms 6492 KB Output is correct
3 Correct 12 ms 5724 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 3996 KB Output is correct
6 Correct 18 ms 8540 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 28 ms 7888 KB Output is correct
9 Correct 28 ms 9688 KB Output is correct
10 Correct 39 ms 12196 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 436 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Incorrect 26 ms 7516 KB wrong motion
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB wrong motion
2 Halted 0 ms 0 KB -