Submission #328275

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3282752020-11-16 04:17:57seedkinGet Hundred Points! (FXCUP4_hundred)C++17
100 / 100
3 ms748 KiB
#include "hundred.h"
#include <stdio.h>
#define aBit 1
#define bBit 2
#define cBit 4
#define aIdx 0
#define bIdx 1
#define cIdx 2
int dir[100][8][100]; // dir[idx][char bit][target idx] = char bit
std::string GetHundredPoints(int A, int B, int C) {
// int a, b, c;
// a = b = c = 0;
int isCorret[105];
int candi[105];
// char ans[100];
int bit[500];
bit['A'] = aBit;
bit['B'] = bBit;
bit['C'] = cBit;
int allBit = 7;
char c[5];
c[aBit] = 'A';
c[bBit] = 'B';
c[cBit] = 'C';
std::string str = std::string(A, 'A') + std::string(B, 'B') + std::string(C, 'C');
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

hundred.cpp: In function 'std::string GetHundredPoints(int, int, int)':
hundred.cpp:67:36: warning: array subscript has type 'char' [-Wchar-subscripts]
   67 |    int other = allBit & ~bit[str[0]] & ~bit[str[i]];
      |                                    ^
hundred.cpp:67:51: warning: array subscript has type 'char' [-Wchar-subscripts]
   67 |    int other = allBit & ~bit[str[0]] & ~bit[str[i]];
      |                                                   ^
hundred.cpp:68:27: warning: array subscript has type 'char' [-Wchar-subscripts]
   68 |    candi[0] &= ~bit[str[0]];
      |                           ^
hundred.cpp:69:27: warning: array subscript has type 'char' [-Wchar-subscripts]
   69 |    candi[i] &= ~bit[str[i]];
      |                           ^
hundred.cpp:70:21: warning: array subscript has type 'char' [-Wchar-subscripts]
   70 |    dir[0][bit[str[i]]][i] = other;
      |                     ^
hundred.cpp:71:33: warning: array subscript has type 'char' [-Wchar-subscripts]
   71 |    dir[0][other][i] = bit[str[0]];
      |                                 ^
hundred.cpp:74:25: warning: array subscript has type 'char' [-Wchar-subscripts]
   74 |    candi[0] = bit[str[i]];
      |                         ^
hundred.cpp:75:25: warning: array subscript has type 'char' [-Wchar-subscripts]
   75 |    candi[i] = bit[str[0]];
      |                         ^
hundred.cpp:80:36: warning: array subscript has type 'char' [-Wchar-subscripts]
   80 |    int other = allBit & ~bit[str[0]] & ~bit[str[i]];
      |                                    ^
hundred.cpp:80:51: warning: array subscript has type 'char' [-Wchar-subscripts]
   80 |    int other = allBit & ~bit[str[0]] & ~bit[str[i]];
      |                                                   ^
hundred.cpp:81:27: warning: array subscript has type 'char' [-Wchar-subscripts]
   81 |    candi[0] &= ~bit[str[i]];
      |                           ^
hundred.cpp:82:27: warning: array subscript has type 'char' [-Wchar-subscripts]
   82 |    candi[i] &= ~bit[str[0]];
      |                           ^
hundred.cpp:83:33: warning: array subscript has type 'char' [-Wchar-subscripts]
   83 |    dir[0][other][i] = bit[str[i]];
      |                                 ^
hundred.cpp:84:21: warning: array subscript has type 'char' [-Wchar-subscripts]
   84 |    dir[0][bit[str[0]]][i] = other;
      |                     ^
hundred.cpp:87:25: warning: array subscript has type 'char' [-Wchar-subscripts]
   87 |    candi[0] = bit[str[0]];
      |                         ^
hundred.cpp:88:25: warning: array subscript has type 'char' [-Wchar-subscripts]
   88 |    candi[i] = bit[str[i]];
      |                         ^
hundred.cpp:110:38: warning: array subscript has type 'char' [-Wchar-subscripts]
  110 |    int other = allBit & ~bit[str[mid]] & ~bit[str[i]];
      |                                      ^
hundred.cpp:110:53: warning: array subscript has type 'char' [-Wchar-subscripts]
  110 |    int other = allBit & ~bit[str[mid]] & ~bit[str[i]];
      |                                                     ^
hundred.cpp:111:31: warning: array subscript has type 'char' [-Wchar-subscripts]
  111 |    candi[mid] &= ~bit[str[mid]];
      |                               ^
hundred.cpp:112:27: warning: array subscript has type 'char' [-Wchar-subscripts]
  112 |    candi[i] &= ~bit[str[i]];
      |                           ^
hundred.cpp:113:23: warning: array subscript has type 'char' [-Wchar-subscripts]
  113 |    dir[mid][bit[str[i]]][i] = other;
      |                       ^
hundred.cpp:114:37: warning: array subscript has type 'char' [-Wchar-subscripts]
  114 |    dir[mid][other][i] = bit[str[mid]];
      |                                     ^
hundred.cpp:117:27: warning: array subscript has type 'char' [-Wchar-subscripts]
  117 |    candi[mid] = bit[str[i]];
      |                           ^
hundred.cpp:118:27: warning: array subscript has type 'char' [-Wchar-subscripts]
  118 |    candi[i] = bit[str[mid]];
      |                           ^
hundred.cpp:123:38: warning: array subscript has type 'char' [-Wchar-subscripts]
  123 |    int other = allBit & ~bit[str[mid]] & ~bit[str[i]];
      |                                      ^
hundred.cpp:123:53: warning: array subscript has type 'char' [-Wchar-subscripts]
  123 |    int other = allBit & ~bit[str[mid]] & ~bit[str[i]];
      |                                                     ^
hundred.cpp:124:29: warning: array subscript has type 'char' [-Wchar-subscripts]
  124 |    candi[mid] &= ~bit[str[i]];
      |                             ^
hundred.cpp:125:29: warning: array subscript has type 'char' [-Wchar-subscripts]
  125 |    candi[i] &= ~bit[str[mid]];
      |                             ^
hundred.cpp:126:35: warning: array subscript has type 'char' [-Wchar-subscripts]
  126 |    dir[mid][other][i] = bit[str[i]];
      |                                   ^
hundred.cpp:127:25: warning: array subscript has type 'char' [-Wchar-subscripts]
  127 |    dir[mid][bit[str[mid]]][i] = other;
      |                         ^
hundred.cpp:130:29: warning: array subscript has type 'char' [-Wchar-subscripts]
  130 |    candi[mid] = bit[str[mid]];
      |                             ^
hundred.cpp:131:25: warning: array subscript has type 'char' [-Wchar-subscripts]
  131 |    candi[i] = bit[str[i]];
      |                         ^
hundred.cpp:142:33: warning: array subscript has type 'char' [-Wchar-subscripts]
  142 |   ans[mid] = c[dir[0][bit[ans[0]]][mid]];
      |                                 ^
hundred.cpp:147:31: warning: array subscript has type 'char' [-Wchar-subscripts]
  147 |   int zero = dir[0][bit[ans[0]]][i];
      |                               ^
hundred.cpp:148:35: warning: array subscript has type 'char' [-Wchar-subscripts]
  148 |   int midV = dir[mid][bit[ans[mid]]][i];
      |                                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...