답안 #890080

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
890080 2023-12-20T13:49:53 Z TAhmed33 Flights (JOI22_flights) C++17
0 / 100
8 ms 1888 KB
#include "Ali.h"
#include <bits/stdc++.h>
using namespace std;
vector <int> adj[10001];
int n2;
void Init (int N, vector <int> a, vector <int> b) {
	n2 = N;
	for (int i = 0; i < n2; i++) adj[i].clear();
	for (int i = 0; i + 1 < n2; i++) {
		adj[a[i]].push_back(b[i]);
		adj[b[i]].push_back(a[i]);
	}
	for (int i = 0; i < n2; i++) {
		SetID(i, i);
	}
}
string get (int x) {
	string ret;
	for (int i = 13; i >= 0; i--) {
		if ((x >> i) & 1) ret += '1';
		else ret += '0';
	}
	return ret;
}
string t;
void dfs (int pos, int par, int dep) {
	t += get(pos);
	t += get(dep);
	for (auto j : adj[pos]) if (j != par) dfs(j, pos, dep + 1);
}
string SendA (string s) {
	int x = 0;
	for (auto i : s) {
		x *= 2; if (i == '1') x++;
	}
	t.clear();
	dfs(x, -1, 0);
	return t;
}
#include "Benjamin.h"
#include <bits/stdc++.h>
using namespace std;
int n, xx, yy;
string SendB (int N, int X, int Y) {
	n = N; xx = X; yy = Y;
	string ret;
	for (int i = 13; i >= 0; i--) {
		if ((xx >> i) & 1) ret += '1';
		else ret += '0';
	}
	while (ret.size() < 20) ret = '0' + ret;	
	return ret;
}
int Answer (string t) {
	for (int i = 0; i < (int)t.length(); i += 28) {
		int z = 0;
		for (int j = i; j <= i + 13; j++) {
			z *= 2; if (t[j] == '1') z++;
		}
		if (z == yy) {
			int ret = 0;
			for (int j = i + 14; j <= i + 27; j++) {
				ret *= 2;
				if (t[j] == '1') ret++;
			}
			return ret;
		}
	}
}

Compilation message

grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
   10 |   char _randmem[12379];
      |        ^~~~~~~~

Benjamin.cpp: In function 'int Answer(std::string)':
Benjamin.cpp:30:1: warning: control reaches end of non-void function [-Wreturn-type]
   30 | }
      | ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1180 KB Output is correct
2 Correct 1 ms 1428 KB Output is correct
3 Correct 1 ms 1092 KB Output is correct
4 Correct 2 ms 1176 KB Output is correct
5 Correct 1 ms 1176 KB Output is correct
6 Failed 7 ms 1880 KB Unexpected end of file - int32 expected (Bruno)
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 1 ms 1272 KB Output is partially correct
2 Failed 8 ms 1888 KB Unexpected end of file - int32 expected (Bruno)
3 Halted 0 ms 0 KB -