QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#511331#5450. 比赛Rafi22#16 6ms7600kbC++142.2kb2024-08-09 19:04:312024-08-09 19:04:32

Judging History

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

  • [2024-08-09 19:04:32]
  • 评测
  • 测评结果:16
  • 用时:6ms
  • 内存:7600kb
  • [2024-08-09 19:04:31]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#ifdef DEBUG
auto&operator<<(auto&o,pair<auto,auto>p){return o<<"("<<p.first<<", "<<p.second<<")";}
auto operator<<(auto&o,auto x)->decltype(x.end(),o){o<<"{";int i=0;for(auto e:x)o<<","+!i++<<e;return o<<"}";}
#define debug(X...)cerr<<"["#X"]: ",[](auto...$){((cerr<<$<<"; "),...)<<endl;}(X)
#else
#define debug(...){}
#endif

#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define FOR(i,l,r) for(int i=(l);i<=(r);i++)
#define ROF(i,r,l) for(int i=(r);i>=(l);i--)
int inf=1000000007;
ll infl=1000000000000000007;
ll mod=1000000007;
ll mod1=998244353;

const int N=2007;

int ile[N];
bool is[N][N];
bool odw[N];
int res[N];

int main()
{
    int tt;
    cin>>tt;
    while(tt--)
    {
        int n,m;
        cin>>n>>m;
        bool ok=1;
        FOR(i,1,m)
        {
            cin>>ile[i];
            if(ile[i]>2*n/3) ok=0;
            FOR(j,1,ile[i])
            {
                int x;
                cin>>x;
                is[x][i]=1;
            }
        }
        if(ok)
        {
            FOR(k,1,n)
            {
                int ban=0;
                FOR(i,1,m)
                {
                    if(k>=3&&is[res[k-1]][i]&&is[res[k-2]][i]) ban=i;
                }
                debug(ban);
                int mx=-1,t=-1;
                FOR(i,1,n)
                {
                    if(odw[i]||is[i][ban]) continue;
                    int act=0;
                    FOR(j,1,m) if(is[i][j]) act=max(act,ile[j]);
                    if(act>mx)
                    {
                        t=i;
                        mx=act;
                    }
                }
                res[k]=t;
                debug(k,t);
                odw[t]=1;
                FOR(j,1,m) if(is[t][j]) ile[j]--;
            }
            FOR(i,1,n) cout<<res[i]<<" ";
            cout<<endl;
        }
        else cout<<-1<<endl;
        FOR(i,1,n)
        {
            odw[i]=0;
            FOR(j,1,m) is[i][j]=0;
        }
    }
    return 0;
}







Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3592kb

input:

248
9 3
3 3 4 5
3 1 2 3
4 6 7 8 9
8 1
4 3 4 5 6
9 2
5 1 2 3 4 5
3 6 7 8
6 1
4 3 4 5 6
7 2
3 3 4 5
3 1 2 3
9 3
4 1 2 3 4
3 4 5 6
3 6 7 8
7 1
4 4 5 6 7
8 2
3 6 7 8
3 2 3 4
8 2
4 1 2 3 4
4 4 5 6 7
3 0
9 3
3 2 3 4
3 7 8 9
3 4 5 6
6 1
5 1 2 3 4 5
9 2
4 1 2 3 4
3 6 7 8
9 3
3 6 7 8
3 3 4 5
3 1 2 3
8 1
8 1 ...

output:

6 1 3 7 4 8 2 5 9 
3 4 1 5 6 2 7 8 
1 2 6 3 4 7 5 8 9 
3 4 1 5 6 2 
1 3 4 2 5 6 7 
1 2 5 6 3 7 4 8 9 
4 5 1 6 7 2 3 
2 6 3 7 4 8 1 5 
1 4 5 2 6 3 7 8 
1 2 3 
2 4 7 5 8 3 6 9 1 
-1
1 2 6 3 7 4 8 5 9 
1 3 6 4 7 2 5 8 9 
-1
-1
1 3 5 6 2 4 7 8 
3 4 1 5 6 2 7 8 9 
4 5 1 6 7 2 3 8 
4 5 1 6 7 2 8 3 9 
1 5 ...

result:

wrong answer [testcase 20] p[9] = 9, p[1] = 4, p[2] = 5 are in the same group #1.

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 10
Accepted

Test #25:

score: 10
Accepted
time: 0ms
memory: 4416kb

input:

5
400 1
266 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

1 2 267 3 4 268 5 6 269 7 8 270 9 10 271 11 12 272 13 14 273 15 16 274 17 18 275 19 20 276 21 22 277 23 24 278 25 26 279 27 28 280 29 30 281 31 32 282 33 34 283 35 36 284 37 38 285 39 40 286 41 42 287 43 44 288 45 46 289 47 48 290 49 50 291 51 52 292 53 54 293 55 56 294 57 58 295 59 60 296 61 62 297...

result:

ok 5 testcases

Test #26:

score: 10
Accepted
time: 1ms
memory: 6196kb

input:

20
134 1
117 1 43 63 117 20 62 41 26 42 80 121 3 71 13 134 60 70 97 64 81 113 15 51 89 59 48 118 78 19 72 119 93 6 38 90 104 102 36 75 14 91 7 57 68 76 10 77 82 108 83 112 5 115 103 95 52 35 120 32 92 45 94 124 44 49 105 34 73 67 21 107 55 133 25 61 29 88 28 110 74 8 69 4 111 98 40 123 130 9 65 16 1...

output:

-1
2 3 1 4 6 5 8 11 7 12 14 9 16 19 10 20 23 13 26 27 15 28 30 17 31 32 18 33 35 21 37 38 22 46 47 24 48 50 25 51 52 29 53 56 34 59 60 36 61 64 39 66 69 40 70 71 41 72 73 42 74 77 43 78 79 44 83 85 45 86 88 49 90 92 54 94 95 55 96 97 57 99 102 58 105 108 62 109 113 63 115 116 65 117 118 67 119 122 6...

result:

ok 20 testcases

Test #27:

score: 10
Accepted
time: 1ms
memory: 4420kb

input:

5
400 1
400 182 293 74 263 144 251 143 394 125 39 267 82 83 84 146 270 345 238 260 335 328 261 393 42 2 25 240 41 388 257 86 187 33 118 192 291 252 400 279 154 181 331 200 3 378 204 50 322 162 112 128 344 166 339 100 245 225 286 395 94 255 301 374 376 56 355 332 307 349 72 67 271 384 280 323 102 243...

output:

-1
-1
2 5 1 7 8 3 9 10 4 14 15 6 18 19 11 21 23 12 24 25 13 27 28 16 29 30 17 32 34 20 35 39 22 40 41 26 43 45 31 46 47 33 48 49 36 50 51 37 53 55 38 56 57 42 59 61 44 64 65 52 66 67 54 72 73 58 74 76 60 77 78 62 80 83 63 84 85 68 87 88 69 89 90 70 91 92 71 93 94 75 96 97 79 99 102 81 103 104 82 105...

result:

ok 5 testcases

Test #28:

score: 10
Accepted
time: 0ms
memory: 4432kb

input:

5
263 1
190 17 200 194 197 141 253 1 261 47 229 36 58 40 116 156 50 83 52 263 225 19 213 66 201 54 87 62 173 110 184 18 208 73 115 160 5 129 77 190 103 193 78 123 257 220 224 85 112 133 33 256 41 20 13 63 56 65 145 109 223 45 134 165 215 12 216 168 238 185 91 250 191 244 147 232 28 174 111 181 130 1...

output:

-1
22 23 1 27 48 2 65 73 3 89 116 4 117 129 5 193 194 6 200 203 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 24 25 26 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 66 67 68 69 70 71 72 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 90 91 92 93...

result:

ok 5 testcases

Test #29:

score: 10
Accepted
time: 1ms
memory: 4292kb

input:

5
250 1
162 86 148 166 152 171 107 43 2 67 40 123 7 205 39 246 206 214 222 12 62 157 218 226 132 195 55 46 88 140 244 9 74 204 91 128 232 191 113 19 145 108 65 167 14 96 4 136 242 68 196 29 81 38 58 122 57 101 208 126 182 188 111 41 13 210 192 175 44 75 183 11 103 137 245 110 18 215 228 33 212 59 23...

output:

2 3 1 4 5 6 7 9 8 10 11 15 12 13 16 14 17 20 18 19 21 28 29 22 32 33 23 35 36 24 38 39 25 40 41 26 43 44 27 46 47 30 50 52 31 55 56 34 57 58 37 59 62 42 63 64 45 65 67 48 68 70 49 74 75 51 76 77 53 79 81 54 83 85 60 86 88 61 90 91 66 92 95 69 96 98 71 99 100 72 101 102 73 103 105 78 106 107 80 108 1...

result:

ok 5 testcases

Test #30:

score: 10
Accepted
time: 1ms
memory: 4180kb

input:

8
199 1
174 12 104 17 6 110 182 2 20 158 179 65 70 91 157 75 169 16 132 83 66 90 166 56 106 94 36 74 164 192 27 34 168 188 15 46 88 43 112 45 64 84 180 86 193 96 121 85 165 29 62 156 147 41 99 160 114 77 153 143 22 174 54 58 120 98 126 129 186 39 190 55 170 177 142 61 116 80 44 138 172 130 93 176 18...

output:

-1
-1
14 20 1 30 51 2 54 63 3 75 79 4 82 88 5 91 97 6 98 104 7 106 109 8 115 118 9 124 134 10 147 159 11 166 182 12 187 193 13 210 214 15 218 222 16 224 17 18 19 21 22 23 24 25 26 27 28 29 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 52 53 55 56 57 58 59 60 61 62 64 65 66 67 68 69 70 ...

result:

ok 8 testcases

Test #31:

score: 10
Accepted
time: 0ms
memory: 3892kb

input:

20
73 1
34 3 52 2 61 12 47 46 6 55 54 29 40 1 25 70 35 11 43 72 26 8 22 60 48 65 31 37 10 19 23 67 5 63 57
41 1
5 12 18 7 13 23
84 1
75 40 39 21 22 57 48 16 82 56 68 75 71 47 80 49 10 67 44 72 73 27 41 6 66 9 74 13 53 65 32 31 76 60 7 59 18 79 28 36 19 58 63 33 5 84 50 8 2 62 78 69 51 37 42 11 4 25 ...

output:

1 2 4 3 5 7 6 8 9 10 11 13 12 19 14 22 23 15 25 26 16 29 31 17 35 37 18 40 43 20 46 47 21 48 52 24 54 55 27 57 60 28 61 63 30 65 67 32 70 72 33 34 36 38 39 41 42 44 45 49 50 51 53 56 58 59 62 64 66 68 69 71 73 
7 12 1 13 18 2 23 3 4 5 6 8 9 10 11 14 15 16 17 19 20 21 22 24 25 26 27 28 29 30 31 32 33...

result:

ok 20 testcases

Test #32:

score: 10
Accepted
time: 0ms
memory: 3712kb

input:

40
39 1
28 24 18 9 32 31 22 10 33 16 29 1 37 3 30 7 27 5 8 38 23 25 26 28 15 13 6 17 35
48 1
3 13 23 36
49 1
37 19 26 27 40 42 20 35 17 45 49 16 46 23 7 4 6 8 11 10 15 2 44 48 32 1 29 38 37 36 13 33 21 30 5 18 12 3
45 1
11 23 5 41 30 28 39 4 43 11 18 31
29 1
9 17 15 5 11 27 16 6 23 1
46 1
9 5 45 42 ...

output:

-1
13 23 1 36 2 3 4 5 6 7 8 9 10 11 12 14 15 16 17 18 19 20 21 22 24 25 26 27 28 29 30 31 32 33 34 35 37 38 39 40 41 42 43 44 45 46 47 48 
-1
4 5 1 11 18 2 23 28 3 30 31 6 39 41 7 43 8 9 10 12 13 14 15 16 17 19 20 21 22 24 25 26 27 29 32 33 34 35 36 37 38 40 42 44 45 
1 5 2 6 11 3 15 16 4 17 23 7 27...

result:

ok 40 testcases

Test #33:

score: 10
Accepted
time: 1ms
memory: 3680kb

input:

80
22 1
8 12 11 16 21 1 6 10 4
21 1
20 20 10 6 19 12 13 2 4 8 17 21 11 3 1 16 14 18 15 9 7
22 1
22 17 1 5 21 2 4 20 7 22 6 9 10 18 14 11 13 19 15 8 12 3 16
16 1
14 14 7 1 3 10 12 16 4 5 9 11 2 6 15
18 1
4 16 8 14 12
15 1
13 8 3 6 2 4 10 15 5 1 9 11 12 13
21 1
5 1 20 18 8 10
24 1
23 20 2 23 21 18 24 ...

output:

1 4 2 6 10 3 11 12 5 16 21 7 8 9 13 14 15 17 18 19 20 22 
-1
-1
-1
8 12 1 14 16 2 3 4 5 6 7 9 10 11 13 15 17 18 
-1
1 8 2 10 18 3 20 4 5 6 7 9 11 12 13 14 15 16 17 19 21 
-1
-1
-1
4 5 1 7 14 2 15 16 3 6 8 9 10 11 12 13 17 
-1
-1
5 6 1 8 12 2 14 17 3 18 19 4 20 23 7 9 10 11 13 15 16 21 22 
1 2 6 3 4 ...

result:

ok 80 testcases

Test #34:

score: 10
Accepted
time: 1ms
memory: 3720kb

input:

200
6 1
5 5 1 4 2 3
10 1
5 7 9 1 8 10
3 1
3 3 2 1
9 1
8 2 3 7 8 1 4 6 9
9 1
6 2 1 9 6 3 5
8 1
8 5 4 1 2 7 6 8 3
6 1
5 6 1 2 3 4
7 1
3 3 2 6
5 1
3 2 5 4
5 1
5 1 4 5 3 2
4 1
3 1 4 3
10 1
10 8 4 6 10 9 3 2 5 1 7
7 1
6 3 2 7 6 5 4
8 1
7 8 2 7 6 4 1 5
8 1
5 4 1 3 5 6
9 1
5 8 7 3 2 5
7 1
7 6 4 1 5 7 2 3
8...

output:

-1
1 7 2 8 9 3 10 4 5 6 
-1
-1
1 2 4 3 5 7 6 9 8 
-1
-1
2 3 1 6 4 5 7 
2 4 1 5 3 
-1
-1
-1
-1
-1
1 3 2 4 5 7 6 8 
2 3 1 5 7 4 8 6 9 
-1
-1
2 4 1 7 10 3 5 6 8 9 
-1
-1
2 3 1 6 7 4 5 
-1
1 2 4 3 5 6 7 8 9 
-1
3 4 1 6 2 5 7 
-1
-1
-1
-1
-1
-1
4 6 1 8 2 3 5 7 
2 5 1 6 8 3 4 7 9 
2 4 1 5 3 6 7 
-1
-1
-1
...

result:

ok 200 testcases

Test #35:

score: 10
Accepted
time: 0ms
memory: 4384kb

input:

13
21 1
6 15 9 16 12 13 2
4 1
3 2 1 4
211 1
105 82 116 52 109 50 158 189 174 115 171 122 60 178 208 142 162 146 29 114 207 141 118 176 4 160 65 144 181 25 134 148 186 106 86 187 159 167 44 129 137 95 20 132 184 102 83 154 157 210 70 78 56 68 32 123 43 42 173 147 93 138 164 48 45 39 79 202 128 121 66...

output:

2 9 1 12 13 3 15 16 4 5 6 7 8 10 11 14 17 18 19 20 21 
-1
2 4 1 5 8 3 11 15 6 18 20 7 22 25 9 26 27 10 29 32 12 33 35 13 39 40 14 41 42 16 43 44 17 45 48 19 50 52 21 54 56 23 57 59 24 60 65 28 66 68 30 70 73 31 78 79 34 82 83 36 86 88 37 93 95 38 98 101 46 102 106 47 109 110 49 111 114 51 115 116 53...

result:

ok 13 testcases

Subtask #5:

score: 0
Wrong Answer

Test #36:

score: 15
Accepted
time: 1ms
memory: 4328kb

input:

5
400 1
266 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 ...

output:

1 2 267 3 4 268 5 6 269 7 8 270 9 10 271 11 12 272 13 14 273 15 16 274 17 18 275 19 20 276 21 22 277 23 24 278 25 26 279 27 28 280 29 30 281 31 32 282 33 34 283 35 36 284 37 38 285 39 40 286 41 42 287 43 44 288 45 46 289 47 48 290 49 50 291 51 52 292 53 54 293 55 56 294 57 58 295 59 60 296 61 62 297...

result:

ok 5 testcases

Test #37:

score: 15
Accepted
time: 6ms
memory: 5900kb

input:

9
317 8
53 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
64 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 ...

output:

252 253 167 254 168 255 169 256 170 257 171 258 172 259 173 260 174 261 175 262 176 263 177 264 1 178 265 2 179 266 3 180 267 4 181 268 5 182 269 6 183 270 7 53 184 271 54 185 272 8 55 186 273 9 56 187 274 10 57 188 275 11 58 189 276 12 59 190 277 13 60 191 278 14 61 118 192 279 15 62 119 193 280 16...

result:

ok 9 testcases

Test #38:

score: 0
Wrong Answer
time: 2ms
memory: 6176kb

input:

14
351 3
143 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147...

output:

68 69 211 70 210 212 71 213 72 214 73 215 74 216 75 217 76 218 77 219 78 220 79 221 80 222 81 223 82 224 83 225 84 226 85 227 86 228 87 229 88 230 89 231 90 232 91 233 92 234 93 235 94 236 95 237 96 238 97 239 98 240 99 241 100 242 101 243 102 244 103 245 104 246 105 247 106 248 107 249 108 250 109 ...

result:

wrong answer [testcase 3] p[301] = 301, p[1] = 124, p[2] = 125 are in the same group #1.

Subtask #6:

score: 0
Skipped

Dependency #1:

0%

Subtask #7:

score: 6
Accepted

Dependency #4:

100%
Accepted

Test #63:

score: 6
Accepted
time: 1ms
memory: 7540kb

input:

1
2000 1
2000 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

-1

result:

ok 1 testcase

Test #64:

score: 6
Accepted
time: 2ms
memory: 4972kb

input:

3
662 1
229 600 517 511 337 123 299 508 267 603 127 57 460 455 372 265 616 202 355 240 37 391 172 597 281 385 270 618 214 541 598 501 330 264 427 516 216 108 582 439 486 481 278 641 590 550 437 331 121 478 64 433 40 114 362 354 498 527 21 591 334 537 432 657 80 163 49 546 134 453 458 242 67 445 197 ...

output:

4 10 1 16 17 2 21 23 3 26 31 5 32 33 6 34 37 7 38 40 8 48 49 9 54 55 11 57 62 12 64 67 13 68 74 14 75 77 15 78 80 18 81 84 19 90 91 20 92 94 22 96 99 24 108 109 25 112 113 27 114 115 28 118 121 29 122 123 30 125 127 35 128 129 36 130 134 39 135 136 41 137 138 42 144 146 43 147 152 44 153 159 45 163 ...

result:

ok 3 testcases

Test #65:

score: 6
Accepted
time: 2ms
memory: 5884kb

input:

4
457 1
252 9 310 262 308 363 73 220 326 362 313 366 57 447 100 408 140 13 228 433 130 435 426 177 277 181 19 44 417 180 40 425 287 327 173 27 128 232 379 58 34 422 443 243 151 217 298 272 28 20 196 317 88 341 72 289 76 424 104 17 138 342 195 295 106 344 7 274 390 182 178 12 4 231 83 233 69 81 105 1...

output:

1 2 3 4 5 6 7 9 8 10 11 15 12 13 18 14 16 22 17 19 23 20 21 24 25 26 31 27 28 32 29 30 35 33 34 36 38 40 37 41 42 39 43 44 47 45 46 48 50 51 49 53 54 52 57 58 55 59 61 56 66 67 60 69 70 62 71 72 63 73 75 64 76 81 65 82 83 68 84 86 74 88 92 77 93 94 78 95 96 79 99 100 80 101 103 85 104 105 87 106 109...

result:

ok 4 testcases

Test #66:

score: 6
Accepted
time: 1ms
memory: 5808kb

input:

10
653 1
138 12 140 404 515 218 619 162 2 411 217 441 631 182 90 395 313 181 245 89 134 58 258 554 215 201 448 341 197 602 593 480 186 590 300 169 45 600 275 289 224 13 651 517 636 612 231 27 272 131 76 295 91 581 466 314 307 248 464 284 204 147 471 606 518 506 428 156 591 306 450 372 566 71 459 1 5...

output:

1 2 3 12 13 4 24 26 5 27 33 6 34 37 7 38 45 8 56 58 9 64 66 10 71 76 11 88 89 14 90 91 15 109 120 16 129 131 17 134 139 18 140 147 19 155 156 20 162 165 21 169 175 22 178 181 23 182 183 25 186 193 28 196 197 29 199 201 30 203 204 31 211 215 32 217 218 35 224 229 36 231 232 39 233 238 40 245 248 41 2...

result:

ok 10 testcases

Test #67:

score: 6
Accepted
time: 3ms
memory: 6948kb

input:

7
4 1
3 2 1 3
66 1
43 55 34 43 49 3 51 41 58 52 57 23 5 6 20 45 61 12 33 46 39 44 2 60 4 16 27 35 32 22 30 9 13 10 37 42 36 7 62 18 64 47 15 54
356 1
195 138 35 115 7 298 169 290 218 68 106 223 78 279 188 172 47 227 176 99 224 155 178 198 177 251 276 191 324 187 111 132 122 221 192 240 225 15 195 2 ...

output:

-1
2 3 1 4 5 8 6 7 11 9 10 14 12 13 17 15 16 19 18 20 21 22 23 24 27 30 25 32 33 26 34 35 28 36 37 29 39 41 31 42 43 38 44 45 40 46 47 48 49 51 50 52 54 53 55 57 56 58 60 59 61 62 63 64 65 66 
2 5 1 6 7 3 10 12 4 13 15 8 16 18 9 19 20 11 21 22 14 24 25 17 27 28 23 30 35 26 37 40 29 42 43 31 44 46 32...

result:

ok 7 testcases

Test #68:

score: 6
Accepted
time: 1ms
memory: 5040kb

input:

8
249 1
231 43 76 106 219 47 63 158 191 237 151 28 149 50 49 62 44 238 97 32 168 25 178 83 27 105 164 122 22 184 65 147 67 247 59 157 186 26 81 200 205 163 134 170 20 64 56 209 10 230 148 177 231 69 214 173 189 152 80 175 141 121 125 241 116 118 31 68 124 71 197 82 2 8 87 225 117 243 196 222 161 156...

output:

-1
-1
2 5 1 8 11 3 12 13 4 17 18 6 19 21 7 25 26 9 27 28 10 29 31 14 32 33 15 34 36 16 37 38 20 40 41 22 43 45 23 46 47 24 48 50 30 54 56 35 57 58 39 59 60 42 61 62 44 63 64 49 65 66 51 68 71 52 72 74 53 76 77 55 79 83 67 84 85 69 86 87 70 88 91 73 92 94 75 95 96 78 98 99 80 102 105 81 107 108 82 11...

result:

ok 8 testcases

Test #69:

score: 6
Accepted
time: 2ms
memory: 6300kb

input:

15
341 1
197 59 87 175 86 177 124 235 269 21 210 194 293 107 158 291 122 328 317 331 226 93 276 333 248 282 157 310 300 245 208 148 52 50 26 164 37 143 169 163 83 297 284 154 341 228 95 149 279 259 309 102 57 137 25 298 153 270 79 327 301 70 184 103 249 126 237 221 82 65 41 152 306 320 55 186 314 33...

output:

2 4 1 5 8 3 9 10 6 12 13 7 14 19 11 20 21 15 25 26 16 27 28 17 32 33 18 35 37 22 38 39 23 41 45 24 46 50 29 51 52 30 53 55 31 57 59 34 62 64 36 65 68 40 69 70 42 71 72 43 74 78 44 79 80 47 81 82 48 83 85 49 86 87 54 92 93 56 94 95 58 100 102 60 103 104 61 107 109 63 111 113 66 117 118 67 122 123 73 ...

result:

ok 15 testcases

Test #70:

score: 6
Accepted
time: 6ms
memory: 7600kb

input:

1
2000 1
1333 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

1 2 1334 3 4 1335 5 6 1336 7 8 1337 9 10 1338 11 12 1339 13 14 1340 15 16 1341 17 18 1342 19 20 1343 21 22 1344 23 24 1345 25 26 1346 27 28 1347 29 30 1348 31 32 1349 33 34 1350 35 36 1351 37 38 1352 39 40 1353 41 42 1354 43 44 1355 45 46 1356 47 48 1357 49 50 1358 51 52 1359 53 54 1360 55 56 1361 5...

result:

ok 1 testcase

Test #71:

score: 6
Accepted
time: 0ms
memory: 7532kb

input:

1
2000 1
1334 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

-1

result:

ok 1 testcase

Test #72:

score: 6
Accepted
time: 6ms
memory: 7528kb

input:

1
1999 1
1332 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

1 2 1333 3 4 1334 5 6 1335 7 8 1336 9 10 1337 11 12 1338 13 14 1339 15 16 1340 17 18 1341 19 20 1342 21 22 1343 23 24 1344 25 26 1345 27 28 1346 29 30 1347 31 32 1348 33 34 1349 35 36 1350 37 38 1351 39 40 1352 41 42 1353 43 44 1354 45 46 1355 47 48 1356 49 50 1357 51 52 1358 53 54 1359 55 56 1360 5...

result:

ok 1 testcase

Test #73:

score: 6
Accepted
time: 2ms
memory: 7452kb

input:

1
1999 1
1333 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

-1

result:

ok 1 testcase

Test #74:

score: 6
Accepted
time: 3ms
memory: 7532kb

input:

1
1998 1
1332 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

1 2 1333 3 4 1334 5 6 1335 7 8 1336 9 10 1337 11 12 1338 13 14 1339 15 16 1340 17 18 1341 19 20 1342 21 22 1343 23 24 1344 25 26 1345 27 28 1346 29 30 1347 31 32 1348 33 34 1349 35 36 1350 37 38 1351 39 40 1352 41 42 1353 43 44 1354 45 46 1355 47 48 1356 49 50 1357 51 52 1358 53 54 1359 55 56 1360 5...

result:

ok 1 testcase

Test #75:

score: 6
Accepted
time: 2ms
memory: 7520kb

input:

1
1998 1
1333 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 9...

output:

-1

result:

ok 1 testcase

Test #76:

score: 6
Accepted
time: 0ms
memory: 3624kb

input:

666
4 1
4 2 4 1 3
3 1
3 2 3 1
3 1
3 1 3 2
3 1
3 1 3 2
3 1
3 3 2 1
3 1
3 3 2 1
3 1
3 3 2 1
3 1
3 3 2 1
3 1
3 1 3 2
3 1
3 1 2 3
3 1
3 2 1 3
3 1
3 2 3 1
3 1
3 2 1 3
3 1
3 2 3 1
3 1
3 2 3 1
3 1
3 2 3 1
3 1
3 3 1 2
3 1
3 1 2 3
3 1
3 2 1 3
3 1
3 1 2 3
3 1
3 1 3 2
3 1
3 3 1 2
3 1
3 3 2 1
3 1
3 2 3 1
3 1
3 ...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 666 testcases

Test #77:

score: 6
Accepted
time: 2ms
memory: 5360kb

input:

2
439 1
275 112 243 59 363 395 337 124 84 37 385 212 9 245 375 348 46 321 436 10 400 25 4 6 435 292 83 433 104 366 415 86 340 235 199 407 401 326 64 325 13 294 207 17 273 341 382 298 214 41 365 206 430 307 426 138 241 169 101 250 282 159 291 234 347 135 92 151 71 357 154 305 306 118 247 256 69 434 3...

output:

3 4 1 5 6 2 8 9 7 10 11 14 12 13 15 16 17 18 20 23 19 25 27 21 28 30 22 32 35 24 36 37 26 38 39 29 41 42 31 44 45 33 46 47 34 49 51 40 52 53 43 54 57 48 59 61 50 62 63 55 64 65 56 66 67 58 68 69 60 70 71 74 72 73 76 75 79 77 82 83 78 84 86 80 87 91 81 92 93 85 95 97 88 98 101 89 102 104 90 105 106 9...

result:

ok 2 testcases

Subtask #8:

score: 0
Skipped

Dependency #5:

0%

Subtask #9:

score: 0
Skipped

Dependency #1:

0%