답안 #1077443

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1077443 2024-08-27T07:17:05 Z thelegendary08 Broken Device (JOI17_broken_device) C++14
85 / 100
30 ms 2884 KB
#include "Annalib.h"
#include<bits/stdc++.h>
#define f0r(i,n) for(int i = 0; i<n;i++)
#define pb push_back
#define vb vector<bool>
#define vi vector<int>
using namespace std;
void Anna( int n, long long x, int k, int p[] ){
	vector<bool>broken(n);
	f0r(i, k){
		broken[p[i]] = 1;
	}
	vb ret(n, 0);
	long long mult = 1;
	f0r(i,37)mult *= 3;
	vi v;
	while(x > 0){
		if(x >= mult * 2)v.pb(2);
		else if(x >= mult)v.pb(1);
		else v.pb(0);
		x -= mult * v[v.size() - 1];
		mult /= 3;
	}
	//cout<<v.size()<<'\n';
	//for(auto u : v)cout<<u<<' ';
	//cout<<'\n';
	
	int ptr = 0;
	f0r(i, 75){
		if(broken[i*2] || broken[i*2+1] || ptr==v.size()){
			ret[i*2] = 0;
			ret[i*2+1] = 0;
		}
		else if(v[ptr] == 0){
			ret[i*2] = 0;
			ret[i*2+1] = 1;
			ptr++;
		}
		else if(v[ptr] == 1){
			ret[i*2] = 1;
			ret[i*2+1] = 0;
			ptr++;
		}
		else {
			ret[i*2] = 1;
			ret[i*2+1] = 1;
			ptr++;
		}
	}
	f0r(i, n){
		Set(i, ret[i]);
	}
	
}
#include "Brunolib.h"
#include<bits/stdc++.h>
#define f0r(i,n) for(int i = 0; i<n;i++)
#define pb push_back
#define vb vector<bool>
#define vi vector<int>
using namespace std;
long long Bruno( int n, int A[] ){
	//for(int i = 0; i<N;i++)cout<<A[i]<<' ';
	//cout<<'\n';
  	long long ret = 0;
  	
  	long long cur = 1;
  	f0r(i, 37)cur *= 3;
  	f0r(i, 75){
  		if(A[i*2]== 1 && A[i*2+1] == 0){
  			ret += cur;
  		}
  		else if(A[i*2] == 1 && A[i*2+1] == 1){
  			ret += cur * 2;
  		}
  		if(A[i*2] != 0 || A[i*2+1] != 0)cur/=3;
  	}
  	//cout<<ret;
  	return ret;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:30:41: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   if(broken[i*2] || broken[i*2+1] || ptr==v.size()){
      |                                      ~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 24 ms 2776 KB Output is partially correct - L* = 37
2 Partially correct 23 ms 2856 KB Output is partially correct - L* = 37
3 Partially correct 23 ms 2744 KB Output is partially correct - L* = 37
4 Partially correct 23 ms 2684 KB Output is partially correct - L* = 37
5 Partially correct 22 ms 2884 KB Output is partially correct - L* = 37
6 Partially correct 22 ms 2864 KB Output is partially correct - L* = 37
7 Partially correct 23 ms 2784 KB Output is partially correct - L* = 37
8 Partially correct 22 ms 2776 KB Output is partially correct - L* = 37
9 Partially correct 22 ms 2780 KB Output is partially correct - L* = 37
10 Partially correct 26 ms 2776 KB Output is partially correct - L* = 37
11 Partially correct 20 ms 2752 KB Output is partially correct - L* = 37
12 Partially correct 22 ms 2872 KB Output is partially correct - L* = 37
13 Partially correct 20 ms 2776 KB Output is partially correct - L* = 37
14 Partially correct 20 ms 2852 KB Output is partially correct - L* = 37
15 Partially correct 20 ms 2772 KB Output is partially correct - L* = 37
16 Partially correct 20 ms 2776 KB Output is partially correct - L* = 37
17 Partially correct 20 ms 2772 KB Output is partially correct - L* = 37
18 Partially correct 22 ms 2768 KB Output is partially correct - L* = 37
19 Partially correct 22 ms 2800 KB Output is partially correct - L* = 37
20 Partially correct 23 ms 2768 KB Output is partially correct - L* = 37
21 Partially correct 22 ms 2744 KB Output is partially correct - L* = 37
22 Partially correct 24 ms 2868 KB Output is partially correct - L* = 37
23 Partially correct 22 ms 2748 KB Output is partially correct - L* = 37
24 Partially correct 20 ms 2764 KB Output is partially correct - L* = 37
25 Partially correct 27 ms 2868 KB Output is partially correct - L* = 37
26 Partially correct 26 ms 2772 KB Output is partially correct - L* = 37
27 Partially correct 23 ms 2776 KB Output is partially correct - L* = 37
28 Partially correct 20 ms 2828 KB Output is partially correct - L* = 37
29 Partially correct 22 ms 2780 KB Output is partially correct - L* = 37
30 Partially correct 23 ms 2780 KB Output is partially correct - L* = 37
31 Partially correct 24 ms 2768 KB Output is partially correct - L* = 37
32 Partially correct 22 ms 2688 KB Output is partially correct - L* = 37
33 Partially correct 23 ms 2684 KB Output is partially correct - L* = 37
34 Partially correct 24 ms 2728 KB Output is partially correct - L* = 37
35 Partially correct 22 ms 2840 KB Output is partially correct - L* = 37
36 Partially correct 23 ms 2808 KB Output is partially correct - L* = 37
37 Partially correct 23 ms 2852 KB Output is partially correct - L* = 37
38 Partially correct 23 ms 2760 KB Output is partially correct - L* = 37
39 Partially correct 30 ms 2748 KB Output is partially correct - L* = 37
40 Partially correct 20 ms 2772 KB Output is partially correct - L* = 37