Submission #565518

# Submission time Handle Problem Language Result Execution time Memory
565518 2022-05-21T03:51:38 Z Rifal Question (Grader is different from the original contest) (CEOI14_question_grader) C++14
100 / 100
3105 ms 24276 KB
#include <bits/stdc++.h>
#include <fstream>
#define endl '\n'
#define mod 32768
#define INF 100000000000000
//#define ll long long
//#define cin fin
//#define cout fout
using namespace std;
//ofstream fout("convention.out");
//ifstream fin("convention.in");
bool sta = false;
int arr[930][13];
void bu()
{
    int cnt = 1;
    for(int i = 0; i < (1<<12); i++)
    {
        int cc = 0;
        for(int j = 0; j < 12; j++)
        {
            if((i&(1<<j)) > 0)
            {
                arr[cnt][j+1] = 1;
                cc++;
            }
            else
            {
               arr[cnt][j+1] = 0;
            }
        }
        if(cc == 6)
        {
            cnt++;
        }
    }
}
int encode (int n, int x, int y) {
    if(!sta)
        bu();
    sta = true;
    for(int i = 1; i <= 12; i++)
    {
        if(arr[x][i] == 1 && arr[y][i] == 0)
        {
            return i;
        }
    }
}
#include <bits/stdc++.h>
#include <fstream>
#define endl '\n'
#define mod 32768
#define INF 100000000000000
//#define ll long long
//#define cin fin
//#define cout fout
using namespace std;
//ofstream fout("convention.out");
//ifstream fin("convention.in");
bool sta = false;
int arr[930][13];
void bu()
{
    int cnt = 1;
    for(int i = 0; i < (1<<12); i++)
    {
        int cc = 0;
        for(int j = 0; j < 12; j++)
        {
            if((i&(1<<j)) > 0)
            {
                arr[cnt][j+1] = 1;
                cc++;
            }
            else
            {
               arr[cnt][j+1] = 0;
            }
        }
        if(cc == 6)
        {
            cnt++;
        }
    }
}
int decode (int n, int q, int h) {
    if(!sta)
        bu();
    sta = true;
    return arr[q][h];
}

Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:49:1: warning: control reaches end of non-void function [-Wreturn-type]
   49 | }
      | ^
# Verdict Execution time Memory Grader output
1 Correct 3105 ms 24180 KB Output is correct - maxh = 12
2 Correct 3038 ms 24276 KB Output is correct - maxh = 12