답안 #231254

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
231254 2020-05-13T08:44:36 Z bensonlzl Broken Device (JOI17_broken_device) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#include "Annalib.h"

using namespace std;

int usable[155], ans[155];

void Anna(int N, long long X, int K, int P[]){
	mt19937 rng(8537295);
	vector<int> v;
	for (int i = 0; i < N; ++i){
		usable[i] = 1;
		ans[i] = 0;
		v.push_back(i);
	}
	shuffle(v.begin(),v.end(),rng);
	for (int i = 0; i < K; ++i){
		usable[P[i]] = 0;
	}
	for (int i = 0; i < N; i += 2){
		if (usable[v[i]] && usable[v[i+1]]){
			if (X%3 == 0){
				ans[v[i]] = 0;
				ans[v[i+1]] = 1;
			}
			else if (X%3 == 0){
				ans[v[i]] = 1;
				ans[v[i+1]] = 0;
			}
			else{
				ans[v[i]] = 1;
				ans[v[i+1]] = 1;
			} 
		}
		else{
			ans[v[i]] = ans[v[i+1]] = 0;
		}
	}
	for (int i = 0; i < N; ++i){
		Set(i,ans[i]);
	}
}
#include <bits/stdc++.h>
#include "Annalib.h"

using namespace std;



long long Bruno(int N, int A[]){
	mt19937 rng(8537295); 
	ll ans = 0;
	vector<int> v;
	for (int i = 0; i < N; ++i){
		v.push_back(i);
	}
	shuffle(v.begin(),v.end(),rng);
	ll coeff = 1;
	for (int i = 0; i < N; i += 2){
		if (A[v[i]] || A[v[i+1]]){
			if (A[v[i]] && !A[v[i+1]]){
				ans += 1*coeff;
			}
			else if (A[v[i]] && A[v[i+1]]){
				ans += 2*coeff;
			}
			coeff *= 3;
			if (coeff > 1e18) break;
		}
	}
	return ans;
}

Compilation message

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:10:2: error: 'll' was not declared in this scope
  ll ans = 0;
  ^~
Bruno.cpp:16:5: error: expected ';' before 'coeff'
  ll coeff = 1;
     ^~~~~
Bruno.cpp:20:5: error: 'ans' was not declared in this scope
     ans += 1*coeff;
     ^~~
Bruno.cpp:20:5: note: suggested alternative: 'abs'
     ans += 1*coeff;
     ^~~
     abs
Bruno.cpp:20:14: error: 'coeff' was not declared in this scope
     ans += 1*coeff;
              ^~~~~
Bruno.cpp:20:14: note: suggested alternative: 'modff'
     ans += 1*coeff;
              ^~~~~
              modff
Bruno.cpp:23:5: error: 'ans' was not declared in this scope
     ans += 2*coeff;
     ^~~
Bruno.cpp:23:5: note: suggested alternative: 'abs'
     ans += 2*coeff;
     ^~~
     abs
Bruno.cpp:23:14: error: 'coeff' was not declared in this scope
     ans += 2*coeff;
              ^~~~~
Bruno.cpp:23:14: note: suggested alternative: 'modff'
     ans += 2*coeff;
              ^~~~~
              modff
Bruno.cpp:25:4: error: 'coeff' was not declared in this scope
    coeff *= 3;
    ^~~~~
Bruno.cpp:25:4: note: suggested alternative: 'modff'
    coeff *= 3;
    ^~~~~
    modff
Bruno.cpp:29:9: error: 'ans' was not declared in this scope
  return ans;
         ^~~
Bruno.cpp:29:9: note: suggested alternative: 'abs'
  return ans;
         ^~~
         abs