Submission #572192

# Submission time Handle Problem Language Result Execution time Memory
572192 2022-06-03T23:56:45 Z RandomLB Question (Grader is different from the original contest) (CEOI14_question_grader) C++17
27 / 100
4376 ms 24276 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
template<class T> using indexed_set = tree<T, null_type, less_equal<T>,
        rb_tree_tag, tree_order_statistics_node_update>;
#define fbo find_by_order //(k-indexed val with 0-indexing)
#define ook order_of_key //(num of vals in set that are strictly less)
#define ms(x, a) memset(x, a, sizeof(x))
#define siz(x) (int)x.size()
#define len(x) (int)x.length()
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vals, Args&&... values){
    cout << vals << " = ";
    string delim = "";
    (...,(cout << delim << values, delim = ", "));
    cout << endl;
}
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9+7;
//===========================================
 
int encode (int n, int a, int b){
    for (int i = 0; i < 10; i++){
        if ((a&(1<<i)) != (b&(1<<i))){
            return ((a&(1<<i))? 11 : 1)+i;
        }
    }
}

int decode (int n, int q, int h){
    bool on = (h > 10);
    if (h > 10) h -= 11;
    else h--;
    return ((q&(1<<h)) > 0 == on? 1 : 0);    
}
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
template<class T> using indexed_set = tree<T, null_type, less_equal<T>,
        rb_tree_tag, tree_order_statistics_node_update>;
#define fbo find_by_order //(k-indexed val with 0-indexing)
#define ook order_of_key //(num of vals in set that are strictly less)
#define ms(x, a) memset(x, a, sizeof(x))
#define siz(x) (int)x.size()
#define len(x) (int)x.length()
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define F first
#define S second
#define deb(...) logger(#__VA_ARGS__, __VA_ARGS__)
template<typename ...Args>
void logger(string vals, Args&&... values){
    cout << vals << " = ";
    string delim = "";
    (...,(cout << delim << values, delim = ", "));
    cout << endl;
}
const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9+7;
//===========================================
 
int encode (int n, int a, int b){
    for (int i = 0; i < 10; i++){
        if ((a&(1<<i)) != (b&(1<<i))){
            return ((a&(1<<i))? 11 : 1)+i;
        }
    }
}

int decode (int n, int q, int h){
    bool on = (h > 10);
    if (h > 10) h -= 11;
    else h--;
    return ((q&(1<<h)) > 0 == on? 1 : 0);    
}

Compilation message

encoder.cpp: In function 'int decode(int, int, int)':
encoder.cpp:46:24: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
   46 |     return ((q&(1<<h)) > 0 == on? 1 : 0);
      |             ~~~~~~~~~~~^~~
encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:40:1: warning: control reaches end of non-void function [-Wreturn-type]
   40 | }
      | ^

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:46:24: warning: suggest parentheses around comparison in operand of '==' [-Wparentheses]
   46 |     return ((q&(1<<h)) > 0 == on? 1 : 0);
      |             ~~~~~~~~~~~^~~
decoder.cpp: In function 'int encode(int, int, int)':
decoder.cpp:40:1: warning: control reaches end of non-void function [-Wreturn-type]
   40 | }
      | ^
# Verdict Execution time Memory Grader output
1 Partially correct 4288 ms 24276 KB Output is partially correct - maxh = 20
2 Partially correct 4376 ms 24196 KB Output is partially correct - maxh = 20