Submission #784043

#TimeUsernameProblemLanguageResultExecution timeMemory
784043AdamGSBroken Device (JOI17_broken_device)C++17
0 / 100
36 ms2712 KiB
#include "Annalib.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
void Anna(int n, ll x, int k, int P[]) {
	vector<int>V(n), czy(n), odw(n);
	srand(213769);
	rep(i, n) {
		V[i]=i;
		swap(V[i], V[rand()%(i+1)]);
	}
	rep(i, k) czy[P[i]]=1;
	ll akt=0;
	rep(i, V.size()-1) if(!czy[V[i]] && !czy[V[i+1]]) {
		Set(V[i], 1);
		odw[V[i]]=1;
		++i;
		if(x&(1ll<<akt)) Set(V[i], 1); else Set(V[i], 0);
		++akt;
		odw[V[i]]=1;
	}
	rep(i, n) if(!odw[i]) Set(i, 0);
}

#include "Brunolib.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
ll Bruno(int n, int A[]) {
	vector<int>V(n);
	srand(213769);
	rep(i, n) {
		V[i]=i;
		swap(V[i], V[rand()%(i+1)]);
	}
	ll akt=0, ans=0;
	rep(i, V.size()-1) if(A[V[i]]) {
		++i;
		if(A[V[i]]) ans+=1ll<<akt;
		++akt;
	}
	return ans;
}

Compilation message (stderr)

Anna.cpp: In function 'void Anna(int, ll, int, int*)':
Anna.cpp:5:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 | #define rep(a, b) for(int a = 0; a < (b); ++a)
      |                                    ^
Anna.cpp:19:2: note: in expansion of macro 'rep'
   19 |  rep(i, V.size()-1) if(!czy[V[i]] && !czy[V[i+1]]) {
      |  ^~~

Bruno.cpp: In function 'll Bruno(int, int*)':
Bruno.cpp:5:36: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 | #define rep(a, b) for(int a = 0; a < (b); ++a)
      |                                    ^
Bruno.cpp:18:2: note: in expansion of macro 'rep'
   18 |  rep(i, V.size()-1) if(A[V[i]]) {
      |  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...