답안 #249831

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
249831 2020-07-15T21:50:10 Z Blagojce Broken Device (JOI17_broken_device) C++11
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h> 
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x), end(x)
#include <time.h>
#include <cmath>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,ll> pii;

const int i_inf = 1e9;
const ll inf = 1e18;
const ll mod = 1000000007;
const ld eps = 1e-13;
const ld pi  = 3.14159265359;
 
mt19937 _rand(15);
clock_t timer = clock();
const int mxn = 5e5;

#include "Annalib.h"


int id[150];

void Anna(int N, long long X, int K, int P[]){
	fr(i, 0, 150){
		id[i] = i;
	}
	for(int i = n - 1; i > 0; i --){
		int j = _rand()%(i+1);
		swap(id[i], id[j]);
	}
	
	bool ok[150];
	memset(ok, false, sizeof(ok));
	
	
	
	fr(i, 0, K) ok[id[P[i]]] = true;
	
	fr(i, 0, 75){
		if(!ok[id[i]] && !ok[id[i]+75]){
			Set(id[i], 1);
		}
		else{
			Set(id[i], 0);
		}
	}
	int tmp = 0;
	fr(i, 0, 75){
		if(tmp>60){
			Set(id[i+75], 0);
			continue;
		}
		if(!ok[id[i]]&&!ok[id[i+75]]){
			if(X&(1LL<<tmp)){
				Set(id[i+75], 1);
			}
			else{
				Set(id[i+75], 0);
			}
			tmp ++;
		}
		else{
			Set(id[i+75], 0);
		}
	}
}
#include <bits/stdc++.h> 
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x), end(x)
#include <time.h>
#include <cmath>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,ll> pii;

const int i_inf = 1e9;
const ll inf = 1e18;
const ll mod = 1000000007;
const ld eps = 1e-13;
const ld pi  = 3.14159265359;
 
mt19937 _rand(15);
clock_t timer = clock();
const int mxn = 5e5;

#include "Brunolib.h"

long long Bruno( int N, int A[]){
	fr(i, 0, 150){
		id[i] = i;
	}
	for(int i = n - 1; i > 0; i --){
		int j = _rand()%(i+1);
		swap(id[i], id[j]);
	}
	
	
	vector<int> pos;
	fr(i, 0, 75) if(A[id[i]] == 1) pos.pb(id[i+75]);
	ll ret = 0;
	fr(i, 0, pos.size()){
		if(A[pos[i]] == 1) ret |= (1LL<<i);
	}
	
	
	return ret;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:35:14: error: 'n' was not declared in this scope
  for(int i = n - 1; i > 0; i --){
              ^

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:30:3: error: 'id' was not declared in this scope
   id[i] = i;
   ^~
Bruno.cpp:30:3: note: suggested alternative: 'i'
   id[i] = i;
   ^~
   i
Bruno.cpp:32:14: error: 'n' was not declared in this scope
  for(int i = n - 1; i > 0; i --){
              ^
Bruno.cpp:34:8: error: 'id' was not declared in this scope
   swap(id[i], id[j]);
        ^~
Bruno.cpp:34:8: note: suggested alternative: 'i'
   swap(id[i], id[j]);
        ^~
        i
Bruno.cpp:39:20: error: 'id' was not declared in this scope
  fr(i, 0, 75) if(A[id[i]] == 1) pos.pb(id[i+75]);
                    ^~
Bruno.cpp:39:20: note: suggested alternative: 'i'
  fr(i, 0, 75) if(A[id[i]] == 1) pos.pb(id[i+75]);
                    ^~
                    i
Bruno.cpp:2:40: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fr(i, n, m) for(int i = (n); i < (m); i ++)
                                        ^
Bruno.cpp:41:2: note: in expansion of macro 'fr'
  fr(i, 0, pos.size()){
  ^~