답안 #55022

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
55022 2018-07-05T20:46:03 Z spencercompton Broken Device (JOI17_broken_device) C++17
0 / 100
134 ms 13528 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
string tostr(ll x){
	string ret = "";
	for(int i = 0; i<60; i++){
		if((x&(1LL<<i))!=0){
			ret += "1";
		}
		else{
			ret += "0";
		}
	}
	return ret;
}
void Anna( int N, long long X, int K, int P[] ){
	srand(42);
	vector<int>  rands;
	bool res[N];
	for(int i = 0; i<N; i++){
		res[i] = false;
	}
	for(int i = 0; i<1000; i++){
		rands.push_back(rand()%2);
	}
	for(int i = 0; i<K; i++){
		res[P[i]] = true;
	}
	string str = tostr(X);
	int pos = 0;
	int cur = 0;
	// if rands[i] = 0,    10 = 00, 11 = 01, 01 = 1
	for(int i = 0; i<N && pos<60; i+=2){
		if(P[i] || P[i+1]){
			continue;
		}
		cur++;
		if(pos==59){
			if(str[pos]=='0'){
				res[i] = false;
				res[i+1] = false;
			}
			else{
				res[i] = true;
				res[i+1] = true;
			}
			break;
		}
		if(str[pos]-'0'==rands[cur]){
			res[i] = true;
			if(str[pos+1]-'0'==rands[cur]){
				res[i+1] = true;
			}
			else{
				res[i+1] = false;
			}
			pos += 2;
		}
		else{
			res[i] = false;
			res[i+1] = true;
			pos++;
		}
	}
	for(int i = 0; i<N; i++){
		Set(i,res[i]?1:0);
	}

}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll fromstr(string s){
	ll ret = 0LL;
	for(int i = 0; i<60; i++){
		if(s[i]=='1'){
			ret += (1LL
				<<i);
		}
	}
}
long long Bruno( int N, int A[] ){
	srand(42);
	vector<int>  rands;
	for(int i = 0; i<1000; i++){
		rands.push_back(rand()%2);
	}
	string str = "";
	int pos = 0;
	int cur = 0;
	// if rands[i] = 0,    10 = 00, 11 = 01, 01 = 1
	for(int i = 0; i<N && (int)str.length()<60; i+=2){
		if(A[i]==0 && A[i+1]==0){
			continue;
		}
		cur++;
		if((int)str.length()==59){
			if(A[i]==0){
				str += "0";
			}
			else{
				str += "1";
			}
			break;
		}
		if(A[i]==1){
			str += (char)(rands[cur]+'0');
			if(A[i+1]==1){
				str += (char)(rands[cur]+'0');
			}
			else{
				str += (char)((1-rands[cur])+'0');
			}
		}
		else{
			str += (char)((1-rands[cur])+'0');
		}
	}
	return fromstr(str);
}

Compilation message

Bruno.cpp: In function 'll fromstr(std::__cxx11::string)':
Bruno.cpp:13:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:21:6: warning: unused variable 'pos' [-Wunused-variable]
  int pos = 0;
      ^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 76 ms 3056 KB Output isn't correct - L* = 0
2 Incorrect 108 ms 3944 KB Output isn't correct - L* = 0
3 Incorrect 76 ms 4200 KB Output isn't correct - L* = 0
4 Incorrect 80 ms 4472 KB Output isn't correct - L* = 0
5 Incorrect 84 ms 4664 KB Output isn't correct - L* = 0
6 Incorrect 70 ms 4912 KB Output isn't correct - L* = 0
7 Incorrect 134 ms 5328 KB Output isn't correct - L* = 0
8 Incorrect 92 ms 5416 KB Output isn't correct - L* = 0
9 Incorrect 77 ms 5664 KB Output isn't correct - L* = 0
10 Incorrect 77 ms 5920 KB Output isn't correct - L* = 0
11 Incorrect 75 ms 6416 KB Output isn't correct - L* = 0
12 Incorrect 74 ms 6416 KB Output isn't correct - L* = 0
13 Incorrect 74 ms 6656 KB Output isn't correct - L* = 0
14 Incorrect 97 ms 6904 KB Output isn't correct - L* = 0
15 Incorrect 78 ms 7176 KB Output isn't correct - L* = 0
16 Incorrect 103 ms 7536 KB Output isn't correct - L* = 0
17 Incorrect 75 ms 7696 KB Output isn't correct - L* = 0
18 Incorrect 88 ms 8168 KB Output isn't correct - L* = 0
19 Incorrect 120 ms 8432 KB Output isn't correct - L* = 0
20 Incorrect 102 ms 8664 KB Output isn't correct - L* = 0
21 Incorrect 100 ms 8928 KB Output isn't correct - L* = 0
22 Incorrect 96 ms 9064 KB Output isn't correct - L* = 0
23 Incorrect 70 ms 9656 KB Output isn't correct - L* = 0
24 Incorrect 76 ms 9672 KB Output isn't correct - L* = 0
25 Incorrect 92 ms 9792 KB Output isn't correct - L* = 0
26 Incorrect 97 ms 10296 KB Output isn't correct - L* = 0
27 Incorrect 66 ms 10544 KB Output isn't correct - L* = 0
28 Incorrect 83 ms 10544 KB Output isn't correct - L* = 0
29 Incorrect 101 ms 10776 KB Output isn't correct - L* = 0
30 Incorrect 87 ms 11016 KB Output isn't correct - L* = 0
31 Incorrect 66 ms 11264 KB Output isn't correct - L* = 0
32 Incorrect 69 ms 11504 KB Output isn't correct - L* = 0
33 Incorrect 74 ms 11752 KB Output isn't correct - L* = 0
34 Incorrect 76 ms 11992 KB Output isn't correct - L* = 0
35 Incorrect 72 ms 12232 KB Output isn't correct - L* = 0
36 Incorrect 75 ms 12488 KB Output isn't correct - L* = 0
37 Incorrect 66 ms 12728 KB Output isn't correct - L* = 0
38 Incorrect 67 ms 13232 KB Output isn't correct - L* = 0
39 Incorrect 72 ms 13232 KB Output isn't correct - L* = 0
40 Incorrect 91 ms 13528 KB Output isn't correct - L* = 0