QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#750857 | #8650. Island Hopping | 275307894a | 2 | 3ms | 3956kb | C++14 | 1.3kb | 2024-11-15 16:07:58 | 2024-11-15 16:07:58 |
answer
#include "island.h"
#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=1e5+5,M=N*4+5,K=1000+5,mod=1e9+7,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(28382);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
#ifdef LOCAL
#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
#else
#define gdb(...) void()
#endif
}using namespace Debug;
int n,siz[N];
void solve(int nn, int lim) {
n=nn;
for(int i=1;i<=n;i++) siz[i]=1;
for(int i=1;i<=n;i++){
for(int j=siz[i];j<n;j++){
int x=query(i,j);
if(x<i||query(x,siz[x])^i) break;
gdb(x,i,j);
answer(x,i);siz[x]++;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 2
Accepted
Test #1:
score: 2
Accepted
time: 1ms
memory: 3776kb
input:
3 9 3 1 0 2 3 3 2 0 1
output:
1 1 3 1 -1 3 1 2 2 1 2 1 3 2 -2 3 2 2 0 0
result:
ok
Test #2:
score: 2
Accepted
time: 1ms
memory: 3820kb
input:
3 9 3 1 0 2 3 3 2 0 1
output:
1 1 3 1 -1 3 1 2 2 1 2 1 3 2 -2 3 2 2 0 0
result:
ok
Test #3:
score: 2
Accepted
time: 0ms
memory: 3856kb
input:
3 9 2 1 0 3 2 3 2 0 1
output:
1 1 2 1 -1 2 1 2 3 1 2 2 3 1 -2 3 3 2 0 0
result:
ok
Subtask #2:
score: 0
Wrong Answer
Test #4:
score: 0
Wrong Answer
time: 3ms
memory: 3908kb
input:
299 89401 79 1 0 213 1 0 20 89 242 2 0 286 2 0 129 271 192 3 0 244 3 0 6 29 69 4 0 227 4 0 148 69 99 5 0 233 5 0 178 52 29 6 0 244 6 0 3 272 7 0 277 7 0 73 147 54 8 0 83 8 0 50 48 67 9 0 149 9 0 145 149 72 10 0 276 10 0 61 162 163 11 0 278 11 0 41 163 196 12 0 226 12 0 29 226 216 13 0 239 13 0 202 1...
output:
1 1 79 1 -1 79 1 2 213 1 -1 213 1 3 20 1 2 1 242 1 -2 242 2 2 286 1 -2 286 2 3 129 1 3 1 192 1 -3 192 3 2 244 1 -3 244 3 3 6 1 4 1 69 1 -4 69 4 2 227 1 -4 227 4 3 148 1 5 1 99 1 -5 99 5 2 233 1 -5 233 5 3 178 1 6 1 29 1 -6 29 6 2 244 2 -6 244 6 3 7 1 272 1 -7 272 7 2 277 1 -7 277 7 3 73 1 8 1 54 1 -...
result:
wrong answer Wrong Answer [5]
Subtask #3:
score: 0
Wrong Answer
Test #9:
score: 0
Wrong Answer
time: 2ms
memory: 3904kb
input:
299 598 43 1 0 151 1 0 66 43 91 2 0 119 2 0 124 36 7 3 0 130 3 0 181 7 115 4 0 139 4 0 129 115 50 5 0 109 5 0 55 50 157 6 0 176 6 0 107 157 181 7 0 130 190 106 8 0 138 8 0 18 103 147 9 0 235 9 0 82 24 44 10 0 197 10 0 100 44 31 11 0 64 11 0 79 31 150 12 0 210 12 0 71 25 195 13 0 271 13 0 178 155 113...
output:
1 1 43 1 -1 43 1 2 151 1 -1 151 1 3 66 1 2 1 91 1 -2 91 2 2 119 1 -2 119 2 3 124 1 3 1 7 1 -3 7 3 2 130 1 -3 130 3 3 181 1 4 1 115 1 -4 115 4 2 139 1 -4 139 4 3 129 1 5 1 50 1 -5 50 5 2 109 1 -5 109 5 3 55 1 6 1 157 1 -6 157 6 2 176 1 -6 176 6 3 107 1 7 2 181 1 -7 181 7 3 130 2 8 1 106 1 -8 106 8 2 ...
result:
wrong answer Wrong Answer [5]
Subtask #4:
score: 0
Wrong Answer
Test #15:
score: 0
Wrong Answer
time: 2ms
memory: 3956kb
input:
299 89401 29 1 0 35 1 0 171 1 0 87 35 153 2 0 230 2 0 163 230 166 3 0 181 3 0 7 166 54 4 0 266 4 0 70 54 65 5 0 159 5 0 77 132 75 6 0 176 6 0 217 75 166 7 0 241 7 0 3 9 8 0 83 8 0 22 83 250 9 0 83 22 88 10 0 141 10 0 136 141 19 11 0 68 19 193 12 0 224 12 0 125 63 154 13 0 215 13 0 119 154 26 14 0 22...
output:
1 1 29 1 -1 29 1 2 35 1 -1 35 1 3 171 1 -1 171 1 4 87 1 2 1 153 1 -2 153 2 2 230 1 -2 230 2 3 163 1 3 1 166 1 -3 166 3 2 181 1 -3 181 3 3 7 1 4 1 54 1 -4 54 4 2 266 1 -4 266 4 3 70 1 5 1 65 1 -5 65 5 2 159 1 -5 159 5 3 77 1 6 1 75 1 -6 75 6 2 176 1 -6 176 6 3 217 1 7 1 166 2 -7 166 7 2 241 1 -7 241 ...
result:
wrong answer Wrong Answer [5]
Subtask #5:
score: 0
Wrong Answer
Test #23:
score: 0
Wrong Answer
time: 0ms
memory: 3916kb
input:
299 897 140 1 0 269 1 0 276 1 0 57 256 39 2 0 121 2 0 87 34 67 3 0 86 3 0 54 86 214 4 0 262 4 0 55 214 234 5 0 244 5 0 84 159 122 6 0 146 6 0 245 146 174 7 0 240 7 0 69 131 227 8 0 237 8 0 123 227 206 9 0 281 9 0 48 91 65 10 0 275 10 0 172 241 41 11 0 254 11 0 38 41 211 12 0 272 12 0 161 211 117 13 ...
output:
1 1 140 1 -1 140 1 2 269 1 -1 269 1 3 276 1 -1 276 1 4 57 1 2 1 39 1 -2 39 2 2 121 1 -2 121 2 3 87 1 3 1 67 1 -3 67 3 2 86 1 -3 86 3 3 54 1 4 1 214 1 -4 214 4 2 262 1 -4 262 4 3 55 1 5 1 234 1 -5 234 5 2 244 1 -5 244 5 3 84 1 6 1 122 1 -6 122 6 2 146 1 -6 146 6 3 245 1 7 1 174 1 -7 174 7 2 240 1 -7 ...
result:
wrong answer Wrong Answer [5]
Subtask #6:
score: 0
Wrong Answer
Test #32:
score: 0
Wrong Answer
time: 0ms
memory: 3912kb
input:
300 90000 133 1 0 179 1 0 89 133 82 2 0 47 82 65 3 0 165 65 266 4 0 283 4 0 48 128 29 5 0 40 5 0 59 5 0 11 29 24 6 0 35 6 0 41 6 0 132 41 28 7 0 234 7 0 18 234 86 8 0 199 86 186 9 0 299 54 109 10 0 231 10 0 271 10 0 51 109 29 11 0 221 11 0 5 105 12 0 112 12 0 131 12 0 17 131 128 13 0 277 13 0 48 128...
output:
1 1 133 1 -1 133 1 2 179 1 -1 179 1 3 89 1 2 1 82 1 -2 82 2 2 47 1 3 1 65 1 -3 65 3 2 165 1 4 1 266 1 -4 266 4 2 283 1 -4 283 4 3 48 1 5 1 29 1 -5 29 5 2 40 1 -5 40 5 3 59 1 -5 59 5 4 11 1 6 1 24 1 -6 24 6 2 35 1 -6 35 6 3 41 1 -6 41 6 4 132 1 7 1 28 1 -7 28 7 2 234 1 -7 234 7 3 18 1 8 1 86 1 -8 86 ...
result:
wrong answer Wrong Answer [5]
Subtask #7:
score: 0
Wrong Answer
Test #58:
score: 0
Wrong Answer
time: 1ms
memory: 3916kb
input:
300 900 201 1 0 228 1 0 171 10 88 2 0 262 88 97 3 0 104 3 0 101 97 35 4 0 183 4 0 236 4 0 61 34 96 5 0 98 5 0 269 5 0 58 96 70 6 0 138 6 0 163 70 60 7 0 141 7 0 13 141 23 8 0 80 8 0 290 8 0 112 143 46 9 0 51 39 76 10 0 171 10 0 40 76 43 11 0 180 11 0 206 11 0 36 43 69 12 0 203 12 0 280 12 0 151 69 1...
output:
1 1 201 1 -1 201 1 2 228 1 -1 228 1 3 171 1 2 1 88 1 -2 88 2 2 262 1 3 1 97 1 -3 97 3 2 104 1 -3 104 3 3 101 1 4 1 35 1 -4 35 4 2 183 1 -4 183 4 3 236 1 -4 236 4 4 61 1 5 1 96 1 -5 96 5 2 98 1 -5 98 5 3 269 1 -5 269 5 4 58 1 6 1 70 1 -6 70 6 2 138 1 -6 138 6 3 163 1 7 1 60 1 -7 60 7 2 141 1 -7 141 7...
result:
wrong answer Wrong Answer [5]
Subtask #8:
score: 0
Wrong Answer
Test #84:
score: 0
Wrong Answer
time: 1ms
memory: 3832kb
input:
299 598 86 1 0 94 1 0 224 94 79 2 0 228 2 0 42 57 49 3 0 166 3 0 234 23 124 4 0 138 83 257 5 0 262 5 0 296 5 0 77 110 51 6 0 129 6 0 158 6 0 40 129 214 7 0 55 51 20 8 0 206 8 0 28 20 50 9 0 64 9 0 105 9 0 32 24 177 10 0 262 77 200 11 0 209 11 0 186 26 238 12 0 150 35 66 13 0 223 13 0 122 223 15 14 0...
output:
1 1 86 1 -1 86 1 2 94 1 -1 94 1 3 224 1 2 1 79 1 -2 79 2 2 228 1 -2 228 2 3 42 1 3 1 49 1 -3 49 3 2 166 1 -3 166 3 3 234 1 4 1 124 1 -4 124 4 2 138 1 5 1 257 1 -5 257 5 2 262 1 -5 262 5 3 296 1 -5 296 5 4 77 1 6 1 51 1 -6 51 6 2 129 1 -6 129 6 3 158 1 -6 158 6 4 40 1 7 1 214 1 -7 214 7 2 55 1 8 1 20...
result:
wrong answer Wrong Answer [5]