QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#522517#4364. Ceiling FunctionRikiSabeWA 0ms4136kbC++144.8kb2024-08-17 00:47:572024-08-17 00:47:57

Judging History

你现在查看的是最新测评结果

  • [2024-08-17 00:47:57]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4136kb
  • [2024-08-17 00:47:57]
  • 提交

answer

#include <bits/stdc++.h>

typedef long long int           ll;
typedef unsigned long long int  ull;
typedef long double             ld;

using namespace std;

//Debug
#define debugList(A)          	if(debug) { cerr << "? " << #A << ": "; if(debug) { bool band = 0; cerr << "[ ";  for(auto x : A) { if(!band) cerr << x , band = 1; else cerr << " , " << x ;} cerr << " ]" << endl; } }
#define debugVar(A)           	if(debug) { cerr << "? " << #A << " : " << A << endl; }
#define debugPair(a,b)          if(debug) { cerr << "?? " << #a << " : " << a << " | " << #b << " : " << b << endl; }
#define debugIterablePairs(P) 	if(debug) { qwer cerr << "? " << #P << " : "; cerr << "{ " << endl; for(auto it : P) { cerr << "    " << it.first << " -> " << it.second << endl; } cerr << "} " << endl; qwer }
#define debugGraph(GP)          if(debug) { cerr << "? " << #GP << " = "; cerr << "{ " << endl; int cntNodes = 0; for(vector<int> adj : GP) { if(adj.size()) { cerr << "   "; cerr << cntNodes << " => "; debugList(adj) } cntNodes ++;} cerr << "}" << endl;}
#define debugGraphWeight(GP) 	if(debug) { cerr << "? " << #GP << " = {" << endl; int cntNodes = 0; for(auto it : GP ){ if( it.size() ){ cerr << cntNodes << " => [ "; for(auto iter : it){ cerr << iter.first << "-w{" << iter.second << "} "; } cerr << "]" << endl; } cntNodes++; } qwer }
#define debug1(a)	 			if(debug) { cerr << "?: [ " << (a)  << " ]" << endl; }
#define debug2(a,b) 			if(debug) { cerr << "??: [ " << (a) << " , " << (b) << " ]" << endl; }
#define debug3(a,b,c) 			if(debug) { cerr << "???: [ " << (a) << " , " << (b) << " , " << (c) << " ]" << endl; }
#define debug4(a,b,c,d) 		if(debug) { cerr << "????: [" << (a) << " , " << (b) << " , " << (c) << " , " << (d) << " ]" << endl; }
#define debugMatrix(arr,F, C)   if(debug) { cerr << "? " << #arr << " = {" << endl; for(int i = 0 ; i < F ; i++){ cerr << "  " << "[ "; for(int j = 0 ; j < C ; j++){ cerr << arr[i][j] << " "; } cerr << "]" << endl;} cerr << "}" << endl; }
#define LINE                    if(debug) { cerr << "----------------------------------------------" << endl;}

#define all(v)  v.begin(),v.end() // inicio - fin
#define rall(v) v.rbegin(),v.rend() // fin - inicio

// CodeForces Optional
#define YES             cout << "YES" << endl;
#define NO              cout << "NO"  << endl;
#define Yes             cout << "Yes" << endl;
#define No              cout << "No"  << endl;
#define YESNO(x)        cout << ((x)? "YES" : "NO") << endl;
#define fix(x)          cout << fixed << setprecision(x);

#define executeTime     cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#define printList(A)    {bool band = 0; for(auto x : A) { if(!band) {cout << x; band = 1;}else {cout << " " << x;}} cout << endl;}
#define FOR(i,a,b)      for(auto i=a ; i<b ; i++)

#define mem(v,x)        memset(v, (x), sizeof(v))
#define make_unique(x)  (x).resize(unique(all((x))) - (x).begin())

#define ii pair<ll,ll> // 2
#define iii pair<ii,int> // 3
#define iiii pair<ii,ii> // 4


// knight moves...
// int dx[8]{-1,-2,-2,-1,1,2,2,1};
// int dy[8]{-2,-1,1,2,2,1,-1,-2};
// grid moves without diagonal
int dx[4]{-1, 0, 1, 0};
int dy[4]{0, 1, 0, -1};
// only all diagonal moves
// int dx[4]{-1,-1,1,1};
// int dy[4]{-1,1,1,-1};
// grid moves with diagonal
// int dx[8]{0,-1,-1,-1,0,1,1,1};
// int dy[8]{-1,-1,0,1,1,1,0,-1};

// Const
const int    N    = 2e5  + 9;
// mods
const int    mod  = 1e9  + 7;
const ll     modL = 1e9  + 7;
// infs
const int    inf  = 1e9  + 9;
const ll     infL = 1e18 + 9;
// Geometry
const double pi  = acos(-1);
const double EPS = 1e-9;

bool debug = { 1 };
void init();

struct Nodo{
    int dato;
    Nodo *izq, *der;
};

Nodo* nuevoNodo(int dato){
    Nodo* nuevo = new Nodo();
    nuevo -> dato = dato;
    nuevo -> izq = NULL;
    nuevo -> der = NULL;
    return nuevo;
}

string str;

Nodo* insert(Nodo* nodo, int dato){
    if( nodo == NULL ){
        return nuevoNodo(dato);
    }
    if( dato < (nodo -> dato) ){
        str += 'R';
        nodo -> izq = insert(nodo -> izq, dato);
    }else{
        str += 'L';
        nodo -> der = insert(nodo -> der, dato);
    }
    return nodo;
}

void solve(int testCase) {
    int n, m;
    cin >> n >> m;
    set<string> st;
    Nodo* nodo;
    while( n-- ){
        str = "";
        nodo = NULL;
        FOR(i,0,m){
            int x; cin >> x;
            nodo = insert(nodo, x);
        }
        debug1(str);
        st.insert(str);
    }
    int ans = st.size();
    cout << (ans > 1 ? ans - 1 : ans) << endl;
}

int main(){
    init();
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int h = 1;
    // cin >> h;
    FOR(i,1, h + 1) solve(i);
    executeTime;
    return 0;
}

void init(){
    cerr << "Mood Try Winner ALL\n";

}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 4136kb

input:

5 3
2 7 1
3 1 4
1 5 9
2 6 5
9 7 3

output:

4

result:

ok single line: '4'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3976kb

input:

3 4
3 1 2 40000
3 4 2 1
33 42 17 23

output:

2

result:

ok single line: '2'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3920kb

input:

1 1
1

output:

1

result:

ok single line: '1'

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3852kb

input:

2 2
1 2
2 1

output:

1

result:

wrong answer 1st lines differ - expected: '2', found: '1'