Submission #1077829

# Submission time Handle Problem Language Result Execution time Memory
1077829 2024-08-27T09:28:22 Z veehj Broken Device (JOI17_broken_device) C++17
0 / 100
2 ms 1208 KB
#include "Annalib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (ll) a.size()
#define all(x) (x).begin(), (x).end()

void set3(int id, int a, int b, int c){
  Set(id, a);
  Set(id+1, b);
  Set(id+2, c);
}

void Anna( int N, long long X, int K, int P[] ){
  ll curr=X;
  set<int> er;
  for(int i=0; i<K; i++) er.insert(P[i]);
  for(int i=0; i<N; i+=3){
    if(er.count(i)+er.count(i+1)+er.count(i+2)>=2 || curr==0){
      set3(i, 0, 0, 0); //0->
      continue;
    }
    if(!(er.count(i) || er.count(i+1) || er.count(i+2))){
      if(curr%4==0) set3(i, 1, 0, 0); //4->00
      if(curr%4==1) set3(i, 1, 0, 1); //5->01
      if(curr%4==2) set3(i, 1, 1, 0); //6->10
      if(curr%4==3) set3(i, 1, 1, 1); //7->11
      curr/=4;
      continue;
    }
    if(curr%2){
      if(er.count(i+2)) set3(i, 0, 1, 1); //3->1
      else set3(i, 0, 0, 1); //1->1
      curr/=2;
    } else {
      if(er.count(i+1)){
        if(curr%4==0) set3(i, 1, 0, 0); //4->00
        if(curr%4==1) set3(i, 1, 0, 1); //5->01
        curr/=4;
      } else {
        set3(i, 0, 1, 0); //2->0
        curr/=2;
      }
    }
  }
}
#include "Brunolib.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define F first
#define S second
#define pb push_back
#define sz(a) (ll) a.size()
#define all(x) (x).begin(), (x).end()

long long Bruno( int N, int A[] ){
  ll ans=0;
  for(int i=0; i<N; i+=3){
    int nw=A[i]*4+A[i+1]*2+A[i+2];
    if(nw==0) continue;
    if(nw==1) ans*=4;
    if(nw==2) ans*=2;
    if(nw==3) ans=ans*2+1;
    if(nw==4) ans=ans*2+1;
    if(nw==5) ans=ans*4+1;
    if(nw==6) ans=ans*4+2;
    if(nw==7) ans=ans*4+3;
  }
  return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 1208 KB Wrong Answer [4]
2 Incorrect 0 ms 800 KB Wrong Answer [4]
3 Incorrect 1 ms 796 KB Wrong Answer [4]
4 Incorrect 1 ms 812 KB Wrong Answer [4]
5 Incorrect 1 ms 808 KB Wrong Answer [4]
6 Incorrect 1 ms 812 KB Wrong Answer [4]
7 Incorrect 1 ms 808 KB Wrong Answer [4]
8 Incorrect 0 ms 796 KB Wrong Answer [4]
9 Incorrect 1 ms 796 KB Wrong Answer [4]
10 Incorrect 2 ms 812 KB Wrong Answer [4]
11 Incorrect 0 ms 812 KB Wrong Answer [4]
12 Incorrect 1 ms 800 KB Wrong Answer [4]
13 Incorrect 1 ms 804 KB Wrong Answer [4]
14 Incorrect 1 ms 796 KB Wrong Answer [4]
15 Incorrect 1 ms 800 KB Wrong Answer [4]
16 Incorrect 2 ms 796 KB Wrong Answer [4]
17 Incorrect 1 ms 804 KB Wrong Answer [4]
18 Incorrect 1 ms 816 KB Wrong Answer [4]
19 Incorrect 1 ms 800 KB Wrong Answer [4]
20 Incorrect 0 ms 800 KB Wrong Answer [4]
21 Incorrect 0 ms 808 KB Wrong Answer [4]
22 Incorrect 1 ms 804 KB Wrong Answer [4]
23 Incorrect 1 ms 812 KB Wrong Answer [4]
24 Incorrect 0 ms 800 KB Wrong Answer [4]
25 Incorrect 0 ms 812 KB Wrong Answer [4]
26 Incorrect 0 ms 816 KB Wrong Answer [4]
27 Incorrect 0 ms 812 KB Wrong Answer [4]
28 Incorrect 2 ms 812 KB Wrong Answer [4]
29 Incorrect 0 ms 916 KB Wrong Answer [4]
30 Incorrect 1 ms 800 KB Wrong Answer [4]
31 Incorrect 0 ms 808 KB Wrong Answer [4]
32 Incorrect 0 ms 800 KB Wrong Answer [4]
33 Incorrect 0 ms 804 KB Wrong Answer [4]
34 Incorrect 0 ms 800 KB Wrong Answer [4]
35 Incorrect 1 ms 800 KB Wrong Answer [4]
36 Incorrect 0 ms 800 KB Wrong Answer [4]
37 Incorrect 1 ms 800 KB Wrong Answer [4]
38 Incorrect 1 ms 800 KB Wrong Answer [4]
39 Incorrect 0 ms 796 KB Wrong Answer [4]
40 Incorrect 1 ms 800 KB Wrong Answer [4]