QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#34753#4251. Gamewilly108#0 1ms3808kbC++201.8kb2022-06-12 06:52:352024-05-26 00:55:51

Judging History

你现在查看的是最新测评结果

  • [2024-05-26 00:55:51]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:3808kb
  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-06-12 06:52:35]
  • 提交

answer


#include "game.h"
//apio 2022 game

//misaka will carry me to master
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <cassert>
#include <algorithm>
#include <vector>
#include <functional>
#include <numeric>
#include <set>
#include <map>
#include <bitset>

#define ll long long
#define lb long double
#define sz(vec) ((int)(vec.size()))
#define all(x) x.begin(), x.end()
#define pb push_back
#define mp make_pair
#define kill(x, s) {int COND = x; if(COND){ cout << s << "\n"; return ; }}

const lb eps = 1e-9;
const ll mod = 1e9 + 7, ll_max = 1e18;
//const ll mod = (1 << (23)) * 119 +1, ll_max = 1e18;
const int MX = 1e3+10, int_max = 0x3f3f3f3f;

struct {
  template<class T>
  operator T() {
    T x; std::cin >> x; return x;
  }
} in;

using namespace std;


int n, k;
bitset<MX> reach[MX];
bitset<MX> qq;

//hi is the largest node that can reach u
//lo is the smallest node u can reach
//if hi[u] >= lo[u] there is a cycle

void init(int _n, int _k){
	n = _n, k = _k;
	for(int i = k-2; i>=0; i--){
		reach[k][k+1] = 1;
		reach[k] |= reach[k+1];
	}
}

int add_teleporter(int a, int b){
	if(a == b && a < k) return 1;
	if(a < k && b < k && b < a) return 1;
	reach[a][b] = 1;
	reach[a] |= reach[b];
	for(int i = 0; i<n; i++){
		if(reach[i][b]) reach[i] |= reach[a];
	}
	qq.reset();
	for(int i = 0; i<k; i++){
		if((qq&reach[i]).count()) return 1;
		qq[i] = 1;
	}
	return 0;
}

/**
void solve(){
	int n = in, m = in, k = in;
	init(n, k);
	for(int i = 1; i<=m; i++){
		int a = in, b = in;
		if(add_teleporter(a, b)) exit(0);
		cerr << i << "\n";
	}
}

int main(){
  cin.tie(0) -> sync_with_stdio(0);

  int T = 1;
  //cin >> T;
  for(int i = 1; i<=T; i++){
		solve();
	}
  return 0;
}

**/



Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 2
Accepted
time: 1ms
memory: 3808kb

input:

1 1
1
893123 893123
-1

output:

0

result:

ok interaction finished.

Test #2:

score: -2
Wrong Answer
time: 1ms
memory: 3804kb

input:

9 9
29
893122 893124
893121 893127
893120 893124
893123 893121
893122 893131
893125 893131
893121 893126
893123 893126
893126 893131
893123 893131
893123 893125
893123 893124
893127 893125
893120 893126
893123 893120
893121 893131
893123 893127
893122 893126
893122 893127
893127 893131
893122 893125...

output:

9

result:

wrong answer Wrong Answer [1]

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%