Submission #733763

# Submission time Handle Problem Language Result Execution time Memory
733763 2023-05-01T09:22:39 Z myrcella Flights (JOI22_flights) C++17
30 / 100
616 ms 1488 KB
//by szh
#include<bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 0x3f
#define rep(i,a,b) for (int i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define ll long long
#define mod 1000000007
#define ALL(x) x.begin(),x.end()
void inc(int &a,int b) {a=(a+b)%mod;}
void dec(int &a,int b) {a=(a-b+mod)%mod;}
int lowbit(int x) {return x&(-x);}
ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;}

const int sz = 1024;
#include "Ali.h"

const int maxn = 10010;

int n;
vector <int> edge[maxn];
int dis[maxn];
pq <pii,vector<pii>,greater<pii>> q;

void Init(int N, std::vector<int> U, std::vector<int> V) {
	n = N;
  rep(i,0,N) {
	  SetID(i,i);
	  while (!edge[i].empty()) edge[i].pop_back();
  }
  rep(i,0,N-1) edge[U[i]].pb(V[i]),edge[V[i]].pb(U[i]);
}

void dijkstra(int u) {
	memset(dis,inf,sizeof(dis));
	dis[u] = 0;
	q.push({0,u});
	while (!q.empty()) {
		int u = q.top().se, d = q.top().fi;
		q.pop();
		if (dis[u]!=d) continue;
		for (int v:edge[u]) if (dis[v] > d+1) dis[v] = d+1, q.push({d+1,v});
	}
	return;
}

std::string SendA(std::string S) {
	int x=0,y=0;
	rep(i,0,10) if (S[9-i]=='1') x += (1<<i);
	rep(i,0,10) if (S[19-i]=='1') y += (1<<i);
	string ret = "";
	for (int u = x;u<n;u+=sz) {
		dijkstra(u);
		for (int v=y;v<n;v+=sz) {
			if (u>v) continue;
			string tmp = "";
			rep(i,0,14) {
				if ((dis[v]>>i)&1) tmp += '1';
				else tmp += '0';
			}
			reverse(ALL(tmp));
			ret += tmp;
		}
	}
  return ret;
}
//by szh
#include<bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pb push_back
#define debug(x) cerr<<#x<<"="<<x<<endl
#define pq priority_queue
#define inf 0x3f
#define rep(i,a,b) for (int i=a;i<(b);i++)
#define MP make_pair
#define SZ(x) (int(x.size()))
#define ll long long
#define mod 1000000007
#define ALL(x) x.begin(),x.end()
void inc(int &a,int b) {a=(a+b)%mod;}
void dec(int &a,int b) {a=(a-b+mod)%mod;}
int lowbit(int x) {return x&(-x);}
ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;}

const int sz = 1024;
#include "Benjamin.h"

int nn;
int st,ed;

std::string SendB(int N, int X, int Y) {
	if (X>Y) swap(X,Y);
  string tmp = "";
  st = X, ed = Y;
  nn = N;
  X %= sz, Y %= sz;
  for (int i=9;i>=0;i--) if ((X>>i)&1) tmp += '1';else tmp+='0';
  for (int i=9;i>=0;i--) if ((Y>>i)&1) tmp += '1';else tmp+='0';
  return tmp;
}

int Answer(std::string T) {
	int cnt = 0;
	int u = st%sz, v = ed%sz;
	while (u!=st or v!=ed) {
		if (u<=v) cnt++;
		if (v+sz>=nn) u += sz, v = ed%sz;
		else v += sz;
	}
	int ret = 0;
	rep(i,0,14) if (T[cnt*14+13-i]=='1') ret += (1<<i);
  return ret;
}

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 2 ms 656 KB Output is correct
2 Correct 2 ms 656 KB Output is correct
3 Correct 1 ms 708 KB Output is correct
4 Correct 1 ms 656 KB Output is correct
5 Correct 2 ms 740 KB Output is correct
6 Correct 16 ms 1324 KB Output is correct
7 Correct 13 ms 1192 KB Output is correct
8 Correct 13 ms 1232 KB Output is correct
9 Correct 12 ms 1320 KB Output is correct
10 Correct 11 ms 1232 KB Output is correct
11 Correct 9 ms 1120 KB Output is correct
12 Correct 13 ms 1340 KB Output is correct
13 Correct 10 ms 1312 KB Output is correct
14 Correct 12 ms 1236 KB Output is correct
15 Correct 6 ms 1236 KB Output is correct
16 Correct 8 ms 1236 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 656 KB Output is correct
2 Partially correct 97 ms 1384 KB Output is partially correct
3 Correct 4 ms 780 KB Output is correct
4 Partially correct 577 ms 1452 KB Output is partially correct
5 Partially correct 556 ms 1344 KB Output is partially correct
6 Partially correct 616 ms 1484 KB Output is partially correct
7 Partially correct 438 ms 1420 KB Output is partially correct
8 Partially correct 557 ms 1456 KB Output is partially correct
9 Partially correct 408 ms 1440 KB Output is partially correct
10 Partially correct 401 ms 1436 KB Output is partially correct
11 Partially correct 559 ms 1456 KB Output is partially correct
12 Partially correct 53 ms 1280 KB Output is partially correct
13 Partially correct 332 ms 1300 KB Output is partially correct
14 Partially correct 342 ms 1468 KB Output is partially correct
15 Correct 4 ms 740 KB Output is correct
16 Partially correct 318 ms 1320 KB Output is partially correct
17 Partially correct 326 ms 1300 KB Output is partially correct
18 Partially correct 328 ms 1424 KB Output is partially correct
19 Partially correct 318 ms 1400 KB Output is partially correct
20 Partially correct 221 ms 1412 KB Output is partially correct
21 Partially correct 442 ms 1412 KB Output is partially correct
22 Partially correct 417 ms 1404 KB Output is partially correct
23 Partially correct 438 ms 1488 KB Output is partially correct
24 Partially correct 429 ms 1472 KB Output is partially correct
25 Partially correct 463 ms 1392 KB Output is partially correct
26 Partially correct 484 ms 1360 KB Output is partially correct
27 Partially correct 401 ms 1388 KB Output is partially correct
28 Partially correct 433 ms 1360 KB Output is partially correct
29 Partially correct 481 ms 1392 KB Output is partially correct
30 Partially correct 434 ms 1324 KB Output is partially correct
31 Partially correct 475 ms 1440 KB Output is partially correct
32 Partially correct 442 ms 1476 KB Output is partially correct
33 Partially correct 458 ms 1456 KB Output is partially correct
34 Partially correct 393 ms 1296 KB Output is partially correct
35 Partially correct 398 ms 1420 KB Output is partially correct
36 Partially correct 434 ms 1464 KB Output is partially correct
37 Partially correct 389 ms 1444 KB Output is partially correct
38 Partially correct 384 ms 1332 KB Output is partially correct
39 Partially correct 67 ms 1280 KB Output is partially correct
40 Partially correct 371 ms 1316 KB Output is partially correct