답안 #1077361

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1077361 2024-08-27T05:58:09 Z thelegendary08 Broken Device (JOI17_broken_device) C++14
45 / 100
30 ms 3036 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);
	vb v;
	f0r(i, 60){
		v.pb((1LL<<i) & x);
	}
	//for(auto u : v)cout<<u<<' ';
	//cout<<'\n';
	int i = 0;
	int ptr = 0;
	while(i < n-3 && ptr < 60){
		if(!broken[i] && !broken[i+1] && !broken[i+2] && !broken[i+3]){
			ret[i] = 1;
			ret[i+1] = v[ptr];
			ret[i+2] = v[ptr + 1];
			ret[i+3] = v[ptr + 2];
			ptr += 3;
			i += 4;
		}
		else i++;
	}
	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;
  	vb ans;
  	int ptr = 0;
  	while(ptr < n - 2){
  		if(A[ptr] == 1){
  			ans.pb(A[ptr + 1]);
  			ans.pb(A[ptr + 2]);
  			ans.pb(A[ptr + 3]);
  			ptr += 4; 
  		}
  		else ptr++;
  	}
  	f0r(i, ans.size()){
  		ret += ans[i] * (1LL << i);
  	}
  	//cout<<ret;
  	return ret;
}

Compilation message

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:3:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    3 | #define f0r(i,n) for(int i = 0; i<n;i++)
......
   23 |    f0r(i, ans.size()){
      |        ~~~~~~~~~~~~~              
Bruno.cpp:23:4: note: in expansion of macro 'f0r'
   23 |    f0r(i, ans.size()){
      |    ^~~
# 결과 실행 시간 메모리 Grader output
1 Partially correct 25 ms 3036 KB Output is partially correct - L* = 19
2 Partially correct 28 ms 2780 KB Output is partially correct - L* = 18
3 Partially correct 20 ms 2772 KB Output is partially correct - L* = 17
4 Partially correct 20 ms 2784 KB Output is partially correct - L* = 18
5 Partially correct 20 ms 3036 KB Output is partially correct - L* = 24
6 Partially correct 20 ms 2680 KB Output is partially correct - L* = 17
7 Partially correct 23 ms 2784 KB Output is partially correct - L* = 19
8 Partially correct 20 ms 2776 KB Output is partially correct - L* = 20
9 Partially correct 20 ms 2776 KB Output is partially correct - L* = 23
10 Partially correct 27 ms 2680 KB Output is partially correct - L* = 19
11 Partially correct 20 ms 2808 KB Output is partially correct - L* = 19
12 Partially correct 22 ms 2776 KB Output is partially correct - L* = 19
13 Partially correct 20 ms 2776 KB Output is partially correct - L* = 19
14 Partially correct 23 ms 2780 KB Output is partially correct - L* = 19
15 Partially correct 22 ms 2772 KB Output is partially correct - L* = 17
16 Partially correct 25 ms 2820 KB Output is partially correct - L* = 17
17 Partially correct 24 ms 2752 KB Output is partially correct - L* = 20
18 Partially correct 25 ms 2736 KB Output is partially correct - L* = 17
19 Partially correct 23 ms 2752 KB Output is partially correct - L* = 19
20 Partially correct 20 ms 2716 KB Output is partially correct - L* = 24
21 Partially correct 23 ms 2780 KB Output is partially correct - L* = 19
22 Partially correct 20 ms 2776 KB Output is partially correct - L* = 23
23 Partially correct 22 ms 2768 KB Output is partially correct - L* = 20
24 Partially correct 23 ms 2860 KB Output is partially correct - L* = 23
25 Partially correct 23 ms 2784 KB Output is partially correct - L* = 17
26 Partially correct 23 ms 2772 KB Output is partially correct - L* = 19
27 Partially correct 26 ms 2772 KB Output is partially correct - L* = 17
28 Partially correct 23 ms 2856 KB Output is partially correct - L* = 18
29 Partially correct 20 ms 2880 KB Output is partially correct - L* = 18
30 Partially correct 22 ms 2752 KB Output is partially correct - L* = 18
31 Partially correct 22 ms 2772 KB Output is partially correct - L* = 24
32 Partially correct 23 ms 2772 KB Output is partially correct - L* = 17
33 Partially correct 20 ms 2780 KB Output is partially correct - L* = 17
34 Partially correct 22 ms 2772 KB Output is partially correct - L* = 18
35 Partially correct 23 ms 2868 KB Output is partially correct - L* = 23
36 Partially correct 20 ms 2776 KB Output is partially correct - L* = 20
37 Partially correct 22 ms 2768 KB Output is partially correct - L* = 17
38 Partially correct 22 ms 2768 KB Output is partially correct - L* = 20
39 Partially correct 30 ms 2908 KB Output is partially correct - L* = 17
40 Partially correct 20 ms 2800 KB Output is partially correct - L* = 22