# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
549893 |
2022-04-16T19:03:41 Z |
BalintR |
Flights (JOI22_flights) |
C++17 |
|
4000 ms |
7376 KB |
#include <vector>
#include <string>
#include <cassert>
#include <iostream>
using namespace std;
#include "Ali.h"
typedef vector<int> vi;
#define boost() cin.sync_with_stdio(0); cin.tie(0)
#define ms(a, x) memset(a, x, sizeof(a))
#define pb push_back
#define fs first
#define sn second
#define ALL(v) (v).begin(), (v).end()
#define SZ(v) ((int) (v).size())
#define lbv(v, x) (lower_bound((v).begin(), (v).end(), x) - (v).begin())
#define ubv(v, x) (upper_bound((v).begin(), (v).end(), x) - (v).begin())
#define FR(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define dbg(x) {cerr << #x << ' ' << x << endl;}
#define dbgArr(arr, n) {cerr << #arr; FR(_i, n) cerr << ' ' << arr[_i]; cerr << endl;}
namespace {
const int MN = 1e4;
const int HALF = 100;
int n;
vi adjList[MN];
int dist[MN];
}
void Init(int N, vi U, vi V){
n = N;
FR(i, n-1){
int a = U[i], b = V[i];
adjList[a].pb(b);
adjList[b].pb(a);
}
FR(i, n){
SetID(i, i);
}
}
void dfs(int n1, int par){
dbg(n1);
dbg(par);
for(int n2 : adjList[n1]){
if(n2 != par){
dist[n2] = dist[n1] + 1;
dfs(n2, n1);
}
}
}
string SendA(string inStr){
assert(SZ(inStr) == 20);
int val = 0;
FR(i, 20) val |= (inStr[i]-'0') << i;
int nodeA = val % MN;
int nodeB = val/MN;
dist[nodeA] = 0;
dfs(nodeA, -1);
string res;
FR(i, HALF){
int v = dist[nodeB*HALF + i];
FR(j, 14) res.pb((v >> j) & 1 ? '1' : '0');
}
dbg(nodeA);
dbg(nodeB);
dbgArr(dist, n);
FR(i, n) adjList[i].clear();
return res;
}
#include <string>
using namespace std;
#include "Benjamin.h"
#define boost() cin.sync_with_stdio(0); cin.tie(0)
#define ms(a, x) memset(a, x, sizeof(a))
#define pb push_back
#define fs first
#define sn second
#define ALL(v) (v).begin(), (v).end()
#define SZ(v) ((int) (v).size())
#define lbv(v, x) (lower_bound((v).begin(), (v).end(), x) - (v).begin())
#define ubv(v, x) (upper_bound((v).begin(), (v).end(), x) - (v).begin())
#define FR(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define FORR(i, a, b) for(int i = (a); i >= (b); i--)
#define dbg(x) {cerr << #x << ' ' << x << endl;}
#define dbgArr(arr, n) {cerr << #arr; FR(_i, n) cerr << ' ' << arr[_i]; cerr << endl;}
namespace {
const int MN = 1e4;
const int HALF = 100;
int n, x, y;
}
string SendB(int N, int X, int Y){
n = N;
x = X;
y = Y;
int v = x + MN*(y/HALF);
string res;
FR(i, 20) res.pb((v >> i) & 1 ? '1' : '0');
return res;
}
int Answer(string str){
int pos = y % HALF;
int res = 0;
FR(i, 14){
res |= (str[pos*14 + i]-'0') << i;
}
return res;
}
Compilation message
grader_ali.cpp:10:8: warning: '{anonymous}::_randmem' defined but not used [-Wunused-variable]
10 | char _randmem[12379];
| ^~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
656 KB |
Output is correct |
2 |
Correct |
1 ms |
668 KB |
Output is correct |
3 |
Correct |
1 ms |
736 KB |
Output is correct |
4 |
Correct |
1 ms |
656 KB |
Output is correct |
5 |
Correct |
1 ms |
740 KB |
Output is correct |
6 |
Correct |
142 ms |
1508 KB |
Output is correct |
7 |
Correct |
136 ms |
1388 KB |
Output is correct |
8 |
Correct |
122 ms |
1444 KB |
Output is correct |
9 |
Correct |
130 ms |
1476 KB |
Output is correct |
10 |
Correct |
152 ms |
1732 KB |
Output is correct |
11 |
Correct |
99 ms |
1196 KB |
Output is correct |
12 |
Correct |
124 ms |
1492 KB |
Output is correct |
13 |
Correct |
123 ms |
1364 KB |
Output is correct |
14 |
Correct |
134 ms |
1452 KB |
Output is correct |
15 |
Correct |
125 ms |
2260 KB |
Output is correct |
16 |
Correct |
126 ms |
1592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Partially correct |
1 ms |
656 KB |
Output is partially correct |
2 |
Partially correct |
1333 ms |
4304 KB |
Output is partially correct |
3 |
Partially correct |
23 ms |
740 KB |
Output is partially correct |
4 |
Execution timed out |
4000 ms |
7376 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |