Submission #588601

# Submission time Handle Problem Language Result Execution time Memory
588601 2022-07-03T16:36:39 Z Tekor Flights (JOI22_flights) C++17
15 / 100
52 ms 1684 KB
#include "Ali.h"
#include <string>
#include <vector>

namespace {

int variable_example = 0;

}

#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int M = 2e4 + 100;
int n;
vector <int> g[M];
bool u[M];
int d[M],p[M];
void Init(int NN, std::vector<int> U, std::vector<int> V) {
	n = NN;
	srand(time(NULL));
	for(int i = 0;i < n;i++)p[i] = i;
	random_shuffle(p,p + n);
	for(int i = 0;i < n;i++) {
		g[i].clear();
		u[i] = 0;
		d[i] = 0;
		SetID(i,p[i]);
	}
	for(int i = 0;i < U.size();i++) {
		g[p[U[i]]].pb(p[V[i]]);
		g[p[V[i]]].pb(p[U[i]]);
	}
}
void bfs(int x) {
	deque <int> q;
	u[x] = 1;
	q.pb(x);
	while(!q.empty()) {
		int v = q.front();
		q.pop_front();
		for(auto to : g[v]) {
			if(u[to])continue;
			d[to] = d[v] + 1;
			u[to] = 1;
			q.pb(to);
		}
	}
}
string trans(int x) {
	string tek;
	for(int i = 0;i <= 13;i++) {
		if(x & (1 << i))tek += "1";
		else tek += "0";
	}
	return tek;
}
string SendA(string S) {
	int tek = 1,st = 0;
	for(int i = 0;i <= 13;i++) {
		if(S[i] == '1')st += tek;
		tek *= 2;
	}
	tek = 1;
	int fin = 0;
	for(int i = 14;i < 20;i++) {
		if(S[i] == '1')fin += tek;
		tek *= 2;
	}
	bfs(st);
	string ans;
	for(int i = 0;i < n;i++) {
		bool ch = 0;
		for(int j = 0;j < 6;j++) {
			if(((i & (1 << j)) && S[j + 14] == '0') || (!(i & (1 << j)) && S[j + 14] == '1')) {
				ch = 1;
				break;
			}
		}
		if(!ch)ans += trans(d[i]);
	}
	return ans;
}
#include "Benjamin.h"
#include <string>
#include <vector>

namespace {

int variable_example = 0;

}
#include <bits/stdc++.h>
using namespace std;
string transf(int x) {
	string tek;
	for(int i = 0;i <= 13;i++) {
		if(x & (1 << i))tek += "1";
		else tek += "0";
	}
	return tek;
}
int star,finf,n;
std::string SendB(int NN, int X, int Y) {
	n = NN;
	star = X;
	finf = Y;
	string val = transf(X);
	string val1 = transf(Y);
	for(int i = 0;i < 6;i++) {
		val += val1[i];
	}
	return val;
}

int Answer(std::string T) {
	string val1 = transf(finf);
	int L = 0;
	for(int i = 0;i < n;i++) {
		bool ch = 0;
		for(int j = 0;j < 6;j++) {
			if(((i & (1 << j)) && val1[j] == '0') || (!(i & (1 << j)) && val1[j] == '1')) {
				ch = 1;
				break;
			}
		}
		if(ch)continue;
		if(i == finf) {
			int val = 0,tek = 1;
			for(int j = L;j < L + 14;j++) {
				if(T[j] == '1')val += tek;
				tek = (tek *  2);
			}
			return val;
		}
		L += 14;
	}
}

Compilation message

Ali.cpp: In function 'void Init(int, std::vector<int>, std::vector<int>)':
Ali.cpp:30:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |  for(int i = 0;i < U.size();i++) {
      |                ~~^~~~~~~~~~
Ali.cpp: At global scope:
Ali.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    7 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
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:34:27: warning: control reaches end of non-void function [-Wreturn-type]
   34 |  string val1 = transf(finf);
      |                           ^
Benjamin.cpp: At global scope:
Benjamin.cpp:7:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
    7 | int variable_example = 0;
      |     ^~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 912 KB Output is correct
2 Correct 1 ms 928 KB Output is correct
3 Correct 1 ms 1004 KB Output is correct
4 Correct 2 ms 1000 KB Output is correct
5 Correct 2 ms 912 KB Output is correct
6 Correct 6 ms 1516 KB Output is correct
7 Correct 7 ms 1496 KB Output is correct
8 Correct 6 ms 1616 KB Output is correct
9 Correct 9 ms 1536 KB Output is correct
10 Correct 8 ms 1608 KB Output is correct
11 Correct 6 ms 1496 KB Output is correct
12 Correct 6 ms 1608 KB Output is correct
13 Correct 8 ms 1508 KB Output is correct
14 Correct 6 ms 1604 KB Output is correct
15 Correct 5 ms 1524 KB Output is correct
16 Correct 6 ms 1520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 912 KB Output is correct
2 Partially correct 52 ms 1684 KB Output is partially correct
3 Halted 0 ms 0 KB -