Submission #1077360

# Submission time Handle Problem Language Result Execution time Memory
1077360 2024-08-27T05:57:29 Z thelegendary08 Broken Device (JOI17_broken_device) C++17
0 / 100
35 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);
	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()){
      |    ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 2776 KB Program terminated incorrectly, or you printed something to stdout
2 Incorrect 20 ms 2784 KB Program terminated incorrectly, or you printed something to stdout
3 Incorrect 22 ms 2772 KB Program terminated incorrectly, or you printed something to stdout
4 Incorrect 22 ms 2776 KB Program terminated incorrectly, or you printed something to stdout
5 Incorrect 26 ms 2772 KB Program terminated incorrectly, or you printed something to stdout
6 Incorrect 22 ms 2752 KB Program terminated incorrectly, or you printed something to stdout
7 Incorrect 22 ms 2872 KB Program terminated incorrectly, or you printed something to stdout
8 Incorrect 26 ms 2848 KB Program terminated incorrectly, or you printed something to stdout
9 Incorrect 20 ms 2748 KB Program terminated incorrectly, or you printed something to stdout
10 Incorrect 22 ms 2816 KB Program terminated incorrectly, or you printed something to stdout
11 Incorrect 22 ms 2768 KB Program terminated incorrectly, or you printed something to stdout
12 Incorrect 26 ms 2812 KB Program terminated incorrectly, or you printed something to stdout
13 Incorrect 23 ms 2776 KB Program terminated incorrectly, or you printed something to stdout
14 Incorrect 22 ms 2772 KB Program terminated incorrectly, or you printed something to stdout
15 Incorrect 26 ms 2676 KB Program terminated incorrectly, or you printed something to stdout
16 Incorrect 20 ms 2884 KB Program terminated incorrectly, or you printed something to stdout
17 Incorrect 23 ms 2764 KB Program terminated incorrectly, or you printed something to stdout
18 Incorrect 22 ms 2772 KB Program terminated incorrectly, or you printed something to stdout
19 Incorrect 28 ms 2692 KB Program terminated incorrectly, or you printed something to stdout
20 Incorrect 25 ms 2852 KB Program terminated incorrectly, or you printed something to stdout
21 Incorrect 23 ms 2772 KB Program terminated incorrectly, or you printed something to stdout
22 Incorrect 22 ms 2772 KB Program terminated incorrectly, or you printed something to stdout
23 Incorrect 27 ms 2748 KB Program terminated incorrectly, or you printed something to stdout
24 Incorrect 24 ms 2776 KB Program terminated incorrectly, or you printed something to stdout
25 Incorrect 22 ms 2776 KB Program terminated incorrectly, or you printed something to stdout
26 Incorrect 23 ms 2792 KB Program terminated incorrectly, or you printed something to stdout
27 Incorrect 26 ms 2880 KB Program terminated incorrectly, or you printed something to stdout
28 Incorrect 23 ms 2768 KB Program terminated incorrectly, or you printed something to stdout
29 Incorrect 23 ms 2848 KB Program terminated incorrectly, or you printed something to stdout
30 Incorrect 24 ms 2776 KB Program terminated incorrectly, or you printed something to stdout
31 Incorrect 20 ms 2764 KB Program terminated incorrectly, or you printed something to stdout
32 Incorrect 26 ms 2772 KB Program terminated incorrectly, or you printed something to stdout
33 Incorrect 27 ms 2748 KB Program terminated incorrectly, or you printed something to stdout
34 Incorrect 35 ms 2844 KB Program terminated incorrectly, or you printed something to stdout
35 Incorrect 24 ms 2784 KB Program terminated incorrectly, or you printed something to stdout
36 Incorrect 22 ms 2776 KB Program terminated incorrectly, or you printed something to stdout
37 Incorrect 20 ms 2868 KB Program terminated incorrectly, or you printed something to stdout
38 Incorrect 23 ms 2768 KB Program terminated incorrectly, or you printed something to stdout
39 Incorrect 23 ms 2668 KB Program terminated incorrectly, or you printed something to stdout
40 Incorrect 23 ms 2776 KB Program terminated incorrectly, or you printed something to stdout