Submission #1054838

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

Compilation message

island.cpp: In function 'bool check(int, int, int)':
island.cpp:11:29: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   11 |         if(order[pch].size()<i+1)order[pch].push_back(query(pch,i+1));
      |            ~~~~~~~~~~~~~~~~~^~~~
island.cpp: In function 'void solve(int, int)':
island.cpp:33:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   33 |         if(order[i].size()<ocur)order[i].push_back(query(i,ocur));
      |            ~~~~~~~~~~~~~~~^~~~~
island.cpp:42:27: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   42 |         if(order[i].size()<ocur)order[i].push_back(query(i,ocur));
      |            ~~~~~~~~~~~~~~~^~~~~
island.cpp:50:31: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   50 |             if(order[i].size()<ocur&&ocur<N)order[i].push_back(query(i,ocur));
      |                ~~~~~~~~~~~~~~~^~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 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 1 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 3 ms 344 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 4 ms 696 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Correct 4 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 344 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 5 ms 600 KB Output is correct
3 Correct 3 ms 596 KB Output is correct
4 Correct 5 ms 472 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 6 ms 480 KB Output is correct
7 Correct 4 ms 440 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Correct 4 ms 436 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 344 KB Output is correct
2 Correct 6 ms 464 KB Output is correct
3 Correct 6 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 4 ms 464 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 4 ms 480 KB Output is correct
8 Correct 5 ms 344 KB Output is correct
9 Correct 5 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 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 3 ms 344 KB Output is correct
6 Correct 5 ms 344 KB Output is correct
7 Correct 4 ms 696 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Correct 4 ms 468 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 5 ms 600 KB Output is correct
12 Correct 3 ms 596 KB Output is correct
13 Correct 5 ms 472 KB Output is correct
14 Correct 4 ms 344 KB Output is correct
15 Correct 6 ms 480 KB Output is correct
16 Correct 4 ms 440 KB Output is correct
17 Correct 4 ms 344 KB Output is correct
18 Correct 4 ms 436 KB Output is correct
19 Correct 6 ms 344 KB Output is correct
20 Correct 4 ms 700 KB Output is correct
21 Correct 6 ms 344 KB Output is correct
22 Correct 5 ms 476 KB Output is correct
23 Correct 4 ms 472 KB Output is correct
24 Correct 5 ms 716 KB Output is correct
25 Correct 4 ms 696 KB Output is correct
26 Correct 4 ms 480 KB Output is correct
27 Correct 6 ms 344 KB Output is correct
28 Correct 5 ms 456 KB Output is correct
29 Correct 4 ms 436 KB Output is correct
30 Correct 5 ms 344 KB Output is correct
31 Correct 4 ms 344 KB Output is correct
32 Correct 4 ms 484 KB Output is correct
33 Correct 5 ms 344 KB Output is correct
34 Correct 6 ms 480 KB Output is correct
35 Correct 6 ms 448 KB Output is correct
36 Correct 4 ms 344 KB Output is correct
37 Correct 6 ms 440 KB Output is correct
38 Correct 4 ms 440 KB Output is correct
39 Correct 4 ms 344 KB Output is correct
40 Correct 5 ms 456 KB Output is correct
41 Correct 5 ms 432 KB Output is correct
42 Correct 5 ms 488 KB Output is correct
43 Correct 5 ms 344 KB Output is correct
44 Correct 4 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 5 ms 344 KB Output is correct
5 Correct 6 ms 464 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
8 Correct 4 ms 464 KB Output is correct
9 Correct 5 ms 344 KB Output is correct
10 Correct 4 ms 480 KB Output is correct
11 Correct 5 ms 344 KB Output is correct
12 Correct 5 ms 604 KB Output is correct
13 Correct 6 ms 488 KB Output is correct
14 Correct 5 ms 460 KB Output is correct
15 Correct 4 ms 488 KB Output is correct
16 Correct 5 ms 476 KB Output is correct
17 Correct 6 ms 432 KB Output is correct
18 Correct 4 ms 344 KB Output is correct
19 Correct 5 ms 480 KB Output is correct
20 Correct 5 ms 704 KB Output is correct
21 Correct 5 ms 344 KB Output is correct
22 Correct 5 ms 344 KB Output is correct
23 Correct 6 ms 484 KB Output is correct
24 Correct 5 ms 344 KB Output is correct
25 Correct 4 ms 436 KB Output is correct
26 Correct 5 ms 344 KB Output is correct
27 Correct 6 ms 484 KB Output is correct
28 Correct 4 ms 436 KB Output is correct
29 Correct 3 ms 344 KB Output is correct
30 Correct 4 ms 344 KB Output is correct
31 Correct 5 ms 344 KB Output is correct
32 Correct 6 ms 484 KB Output is correct
33 Correct 5 ms 344 KB Output is correct
34 Correct 4 ms 436 KB Output is correct
35 Correct 5 ms 344 KB Output is correct
36 Correct 4 ms 468 KB Output is correct
37 Correct 5 ms 436 KB Output is correct
38 Correct 6 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 344 KB Wrong Answer [3]
2 Halted 0 ms 0 KB -