Submission #1054841

# Submission time Handle Problem Language Result Execution time Memory
1054841 2024-08-12T12:33:14 Z Warinchai Island Hopping (JOI24_island) C++17
26 / 100
6 ms 700 KB
#include "island.h"
#include<bits/stdc++.h>
using namespace std;
vector<int>order[305];
map<pair<int,int>,int>mp;
int child[305];
bool check(int p,int ch,int pch){
    //cerr<<"pchild:"<<pch<<"\n";
    for(int i=0;i<order[pch].size();i++){
        if(order[pch][i]==p)return true;
        else if(child[order[pch][i]])return false;
    }
    return true;
}
void solve(int N, int L) {
    for(int i=1;i<=N;i++){
        for(int j=1;j<=2;j++){
            int x=query(i,j);
            order[i].push_back(x);
        }
    }
    for(int i=1;i<=N;i++){
        //cerr<<i<<"\n";
        for(int i=1;i<=N;i++)child[i]=0;
        int ch=order[i][0];
        //cerr<<"child:"<<ch<<"\n";
        child[ch]=1;
        if(!mp[{ch,i}])mp[{ch,i}]++,mp[{i,ch}]++,answer(i,ch);
        int cur=1;
        if(cur<N-1&&check(i,ch,order[i][cur])){
            if(!mp[{order[i][cur],i}])mp[{order[i][cur],i}]++,mp[{i,order[i][cur]}]++,answer(i,order[i][cur]);
            child[order[i][cur]]=1;
            cur++;
        }
    }
}

Compilation message

island.cpp: In function 'bool check(int, int, int)':
island.cpp:9:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |     for(int i=0;i<order[pch].size();i++){
      |                 ~^~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 4 ms 444 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 4 ms 456 KB Output is correct
8 Correct 6 ms 344 KB Output is correct
9 Correct 3 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 4 ms 452 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 4 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Wrong Answer [5]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 600 KB Output is correct
2 Correct 3 ms 436 KB Output is correct
3 Correct 5 ms 468 KB Output is correct
4 Correct 3 ms 700 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 3 ms 480 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
8 Correct 3 ms 344 KB Output is correct
9 Correct 3 ms 480 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 4 ms 444 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 4 ms 456 KB Output is correct
8 Correct 6 ms 344 KB Output is correct
9 Correct 3 ms 344 KB Output is correct
10 Incorrect 0 ms 344 KB Wrong Answer [5]
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 2 ms 600 KB Output is correct
5 Correct 3 ms 436 KB Output is correct
6 Correct 5 ms 468 KB Output is correct
7 Correct 3 ms 700 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Correct 3 ms 480 KB Output is correct
10 Correct 4 ms 344 KB Output is correct
11 Correct 3 ms 344 KB Output is correct
12 Correct 3 ms 480 KB Output is correct
13 Incorrect 4 ms 344 KB Wrong Answer [5]
14 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 5 ms 344 KB Output is correct
3 Correct 4 ms 452 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 4 ms 440 KB Output is correct
7 Incorrect 4 ms 344 KB Wrong Answer [5]
8 Halted 0 ms 0 KB -