Submission #63297

# Submission time Handle Problem Language Result Execution time Memory
63297 2018-08-01T09:44:58 Z Arturgo Broken Device (JOI17_broken_device) C++14
0 / 100
7 ms 3216 KB
#include <iostream>
#include <vector>
#include "Annalib.h"
using namespace std;

vector<vector<int>> motifs = {
  {1, 1, 1},
  {1, 1, 0},
  {0, 1, 1},
  {0, 0, 1},
  {1, 0, 1},
  {0, 1, 0},
  {1, 0, 0},
  {0, 0, 0}
};

vector<vector<int>> reponses = {
  {1, 1},
  {1, 0},
  {0, 1},
  {0, 0},
  {1},
  {1},
  {0},
  {}
};

void Anna(int N, long long X, int K, int P[]) {
  vector<int> broken(N, 0);

  for(int iBroken = 0;iBroken < K;iBroken++) {
    broken[P[iBroken]] = 1;
  }

  vector<bool> number(1000, 0);
  for(int iBit = 0;iBit < 60;iBit++) {
    number[iBit] = X % 2;
    X /= 2;
  }

  int it = 0;
  for(int pos = 0;pos < N/3;pos++) {
    for(int iMotif = 0;iMotif < 8;iMotif++) {
      bool estValide = true;

      for(int iBit = 0;iBit < 3;iBit++)
	if(broken[3 * pos + iBit] == 1 && motifs[iMotif][iBit] == 1)
	  estValide = false;

      for(int iBit = 0;iBit < reponses[iMotif].size();iBit++)
	if(reponses[iMotif][iBit] != number[it + iBit])
	  estValide = false;
      
      if(estValide) {
	for(int iBit = 0;iBit < 3;iBit++) {
	  Set(3 * pos + iBit, motifs[iMotif][iBit]);
	}
        it += reponses[iMotif].size();
      }
    }
  }

  for(int iBit = 3 * (N / 3);iBit < N;iBit++) {
    Set(iBit, 0);
  }
}
#include <iostream>
#include <vector>
#include "Brunolib.h"
using namespace std;

vector<vector<int>> motifs = {
  {1, 1, 1},
  {1, 1, 0},
  {0, 1, 1},
  {0, 0, 1},
  {1, 0, 1},
  {0, 1, 0},
  {1, 0, 0},
  {0, 0, 0}
};

vector<vector<int>> reponses = {
  {1, 1},
  {1, 0},
  {0, 1},
  {0, 0},
  {1},
  {1},
  {0},
  {}
};

long long Bruno(int N, int A[]) {
  long long X = 0, exp = 1;

  for(int pos = 0;pos < N / 3;pos++) {
    for(int iMotif = 0;iMotif < 8;iMotif++) {
      bool estValide = true;
      for(int iBit = 0;iBit < 3;iBit++) 
	if(A[3 * pos + iBit] != motifs[iMotif][iBit]) 
	  estValide = false;

      if(estValide) {
	for(int bit : reponses[iMotif]) {
	  X += bit * exp;
	  exp *= 2;
	}
      }
    }
  }

  return X;
}

Compilation message

Anna.cpp: In function 'void Anna(int, long long int, int, int*)':
Anna.cpp:50:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int iBit = 0;iBit < reponses[iMotif].size();iBit++)
                        ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 872 KB Wrong Answer [2]
2 Incorrect 6 ms 1420 KB Wrong Answer [2]
3 Incorrect 6 ms 1472 KB Wrong Answer [2]
4 Incorrect 7 ms 1648 KB Wrong Answer [2]
5 Incorrect 5 ms 1736 KB Wrong Answer [2]
6 Incorrect 4 ms 1776 KB Wrong Answer [2]
7 Incorrect 6 ms 1920 KB Wrong Answer [2]
8 Incorrect 4 ms 1992 KB Wrong Answer [2]
9 Incorrect 5 ms 2272 KB Wrong Answer [2]
10 Incorrect 7 ms 2272 KB Wrong Answer [2]
11 Incorrect 6 ms 2272 KB Wrong Answer [2]
12 Incorrect 5 ms 2272 KB Wrong Answer [2]
13 Incorrect 6 ms 2272 KB Wrong Answer [2]
14 Incorrect 5 ms 2272 KB Wrong Answer [2]
15 Incorrect 4 ms 2488 KB Wrong Answer [2]
16 Incorrect 5 ms 2504 KB Wrong Answer [2]
17 Incorrect 6 ms 2504 KB Wrong Answer [2]
18 Incorrect 4 ms 2504 KB Wrong Answer [2]
19 Incorrect 5 ms 2504 KB Wrong Answer [2]
20 Incorrect 6 ms 2504 KB Wrong Answer [2]
21 Incorrect 5 ms 2504 KB Wrong Answer [2]
22 Incorrect 4 ms 2504 KB Wrong Answer [2]
23 Incorrect 5 ms 2504 KB Wrong Answer [2]
24 Incorrect 5 ms 2520 KB Wrong Answer [2]
25 Incorrect 6 ms 2544 KB Wrong Answer [2]
26 Incorrect 5 ms 2596 KB Wrong Answer [2]
27 Incorrect 5 ms 2608 KB Wrong Answer [2]
28 Incorrect 4 ms 2648 KB Wrong Answer [2]
29 Incorrect 5 ms 2672 KB Wrong Answer [2]
30 Incorrect 4 ms 2704 KB Wrong Answer [2]
31 Incorrect 6 ms 2744 KB Wrong Answer [2]
32 Incorrect 4 ms 2768 KB Wrong Answer [2]
33 Incorrect 6 ms 3056 KB Wrong Answer [2]
34 Incorrect 6 ms 3056 KB Wrong Answer [2]
35 Incorrect 4 ms 3056 KB Wrong Answer [2]
36 Incorrect 6 ms 3056 KB Wrong Answer [2]
37 Incorrect 7 ms 3056 KB Wrong Answer [2]
38 Incorrect 4 ms 3216 KB Wrong Answer [2]
39 Incorrect 3 ms 3216 KB Wrong Answer [2]
40 Incorrect 5 ms 3216 KB Wrong Answer [2]