답안 #587593

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
587593 2022-07-02T06:29:48 Z Tekor Flights (JOI22_flights) C++17
15 / 100
42 ms 1604 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];
void Init(int NN, std::vector<int> U, std::vector<int> V) {
	n = NN;
	for(int i = 0;i < n;i++) {
		g[i].clear();
		u[i] = 0;
		d[i] = 0;
		SetID(i,i);
	}
	for(int i = 0;i < U.size();i++) {
		g[U[i]].pb(V[i]);
		g[V[i]].pb(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:27:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |  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;
      |     ^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1000 KB Output is correct
2 Correct 0 ms 912 KB Output is correct
3 Correct 2 ms 912 KB Output is correct
4 Correct 1 ms 912 KB Output is correct
5 Correct 1 ms 996 KB Output is correct
6 Correct 6 ms 1396 KB Output is correct
7 Correct 6 ms 1572 KB Output is correct
8 Correct 7 ms 1452 KB Output is correct
9 Correct 6 ms 1604 KB Output is correct
10 Correct 6 ms 1544 KB Output is correct
11 Correct 4 ms 1404 KB Output is correct
12 Correct 6 ms 1536 KB Output is correct
13 Correct 6 ms 1452 KB Output is correct
14 Correct 5 ms 1552 KB Output is correct
15 Correct 6 ms 1560 KB Output is correct
16 Correct 6 ms 1452 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 980 KB Output is correct
2 Partially correct 42 ms 1568 KB Output is partially correct
3 Halted 0 ms 0 KB -