Submission #64228

# Submission time Handle Problem Language Result Execution time Memory
64228 2018-08-03T14:08:51 Z zadrga Broken Device (JOI17_broken_device) C++14
51 / 100
345 ms 12024 KB
#include "Annalib.h"
#include <bits/stdc++.h>

using namespace std;
 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (1LL << 55)
#define MOD (1000 * 1000 * 1000 + 7)
#define maxn 1000111
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

vector<int> v, block;
int arr[maxn];

void Anna(int N, long long X, int K, int P[]){
//	cout  << N << "  " << X  << "  " << K<< endl;
	v.clear(); block.clear();
	memset(arr, 0, sizeof(arr));

	for(int i = 0; i < 60; i++){
		if((X >> i) & 1)
			v.pb(1);
		else
			v.pb(0);
	}

	block.pb(-1);
	for(int i = 0; i < K; i++)
		block.pb(P[i]);
	block.pb(N + 1);

	int ind = 0;
	for(int i = 1; i < block.size(); i++){
		int x = block[i - 1] + 1;

		while(ind < v.size() && block[i] - x >= 3){
			arr[x++] = 1;
			arr[x++] = v[ind++];
			arr[x++] = v[ind++];
		}
	}

	for(int i = 0; i < N; i++){
		Set(i, arr[i]);
//		cout << i << "  "<< arr[i] << endl;
	}
}
#include "Brunolib.h"
#include <bits/stdc++.h>

using namespace std;
 
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (1LL << 55)
#define MOD (1000 * 1000 * 1000 + 7)
#define maxn 1000111
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;


vector<int> v1;

long long Bruno(int N, int A[]){
	v1.clear();
	for(int i = 0; i < N; i++){
		if(A[i] == 1){
			v1.pb(A[i + 1]);
			v1.pb(A[i + 2]);
			i += 2;
		}
	}

	ll ret = 0;
	for(int i = 0; i < v1.size(); i++)
		ret += (1LL << i) * v1[i];

//	cout << ret << endl;

	return ret;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:39:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 1; i < block.size(); i++){
                 ~~^~~~~~~~~~~~~~
Anna.cpp:42:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(ind < v.size() && block[i] - x >= 3){
         ~~~~^~~~~~~~~~

Bruno.cpp: In function 'long long int Bruno(int, int*)':
Bruno.cpp:32:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = 0; i < v1.size(); i++)
                 ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 259 ms 10856 KB Output is partially correct - L* = 20
2 Partially correct 257 ms 11296 KB Output is partially correct - L* = 20
3 Partially correct 285 ms 11448 KB Output is partially correct - L* = 20
4 Partially correct 269 ms 11448 KB Output is partially correct - L* = 20
5 Partially correct 262 ms 11448 KB Output is partially correct - L* = 20
6 Partially correct 301 ms 11448 KB Output is partially correct - L* = 20
7 Partially correct 297 ms 11512 KB Output is partially correct - L* = 20
8 Partially correct 306 ms 11512 KB Output is partially correct - L* = 20
9 Partially correct 303 ms 11744 KB Output is partially correct - L* = 20
10 Partially correct 318 ms 11744 KB Output is partially correct - L* = 21
11 Partially correct 289 ms 11744 KB Output is partially correct - L* = 20
12 Partially correct 279 ms 11776 KB Output is partially correct - L* = 21
13 Partially correct 289 ms 11824 KB Output is partially correct - L* = 20
14 Partially correct 276 ms 11824 KB Output is partially correct - L* = 20
15 Partially correct 345 ms 11824 KB Output is partially correct - L* = 20
16 Partially correct 269 ms 11824 KB Output is partially correct - L* = 21
17 Partially correct 328 ms 11824 KB Output is partially correct - L* = 20
18 Partially correct 297 ms 11824 KB Output is partially correct - L* = 20
19 Partially correct 272 ms 11824 KB Output is partially correct - L* = 20
20 Partially correct 270 ms 11824 KB Output is partially correct - L* = 21
21 Partially correct 263 ms 11824 KB Output is partially correct - L* = 20
22 Partially correct 292 ms 11824 KB Output is partially correct - L* = 20
23 Partially correct 292 ms 11824 KB Output is partially correct - L* = 20
24 Partially correct 285 ms 11824 KB Output is partially correct - L* = 21
25 Partially correct 297 ms 11824 KB Output is partially correct - L* = 21
26 Partially correct 280 ms 11896 KB Output is partially correct - L* = 20
27 Partially correct 275 ms 11896 KB Output is partially correct - L* = 20
28 Partially correct 284 ms 11896 KB Output is partially correct - L* = 21
29 Partially correct 260 ms 11896 KB Output is partially correct - L* = 20
30 Partially correct 323 ms 11896 KB Output is partially correct - L* = 20
31 Partially correct 314 ms 11896 KB Output is partially correct - L* = 20
32 Partially correct 325 ms 11896 KB Output is partially correct - L* = 20
33 Partially correct 301 ms 11896 KB Output is partially correct - L* = 20
34 Partially correct 256 ms 11896 KB Output is partially correct - L* = 20
35 Partially correct 280 ms 11896 KB Output is partially correct - L* = 20
36 Partially correct 301 ms 11896 KB Output is partially correct - L* = 21
37 Partially correct 306 ms 11896 KB Output is partially correct - L* = 20
38 Partially correct 295 ms 11896 KB Output is partially correct - L* = 20
39 Partially correct 319 ms 11896 KB Output is partially correct - L* = 21
40 Partially correct 311 ms 12024 KB Output is partially correct - L* = 20