답안 #472502

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
472502 2021-09-13T16:28:25 Z Blobo2_Blobo2 Political Development (BOI17_politicaldevelopment) C++14
39 / 100
3000 ms 29652 KB
/*
Editor: Abdelrahman Hossam
Nickname: Blobo2_Blobo2
IOI next year isA :)
*/
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-funroll-all-loops,-fpeel-loops,-funswitch-loops")

#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define endl "\n"
#define all(v)  v.begin(),v.end()
#define gen(arr,n,nxt)  generate(arr,arr+n,nxt)
#define Blobo2_el_7akim_elly_3ayz_yro7_IOI_w_3ayz_yakol_jilaty ios_base::sync_with_stdio(false);cin.tie(0);
#define EPS 0.00000001

const int mo=1e9+7,INF=1e18;
int nxt(){int x;cin>>x;return x;}
int now=-1;
vector<int>adj[50001];
unordered_set<int>st[50001];
bool vis[50001];
vector<int>path;
int justcheckingsmth =0;
void dfs(int u){
    if(path.size()+1 == now){
        cout<<now<<endl;
        exit(0);
    }
    vis[u] = 1;
    path.push_back(u);
    for(auto v:adj[u]){
        if(!vis[v]&&justcheckingsmth<v){
            bool iwillgothere = 1;
            for(int i=0;i<path.size();i++){
                if(st[path[i]].find(v) != st[path[i]].end());
                else iwillgothere&=0;
            }
            if(iwillgothere)
                dfs(v);
        }
    }
    path.pop_back();
}
signed main(){
    Blobo2_el_7akim_elly_3ayz_yro7_IOI_w_3ayz_yakol_jilaty
    //freopen("in.txt","r",stdin);
    int n=nxt(),k=nxt();
    for(int i=0;i<n;i++){
        int sz = nxt();
        for(int j=0;j<sz;j++){
            int x=nxt();
            adj[i].push_back(x);
            st[i].insert(x);
        }
    }
    int ans = -1;
    for(ans = k;ans>=1;ans--){
        now = ans;
        for(int i =0;i<n;i++){
            justcheckingsmth = i;
            dfs(i);
            for(int j=i;j<n;j++)vis[j] = 0;
        }
    }
    return 0;
}

Compilation message

politicaldevelopment.cpp:21:24: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   21 | const int mo=1e9+7,INF=1e18;
      |                        ^~~~
politicaldevelopment.cpp: In function 'void dfs(int)':
politicaldevelopment.cpp:30:22: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   30 |     if(path.size()+1 == now){
      |        ~~~~~~~~~~~~~~^~~~~~
politicaldevelopment.cpp:39:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |             for(int i=0;i<path.size();i++){
      |                         ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4172 KB Output is correct
2 Correct 3 ms 4172 KB Output is correct
3 Correct 8 ms 5260 KB Output is correct
4 Correct 6 ms 5216 KB Output is correct
5 Correct 6 ms 5196 KB Output is correct
6 Correct 6 ms 5324 KB Output is correct
7 Correct 7 ms 5324 KB Output is correct
8 Correct 5 ms 4172 KB Output is correct
9 Correct 3 ms 4172 KB Output is correct
10 Correct 3 ms 4172 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4172 KB Output is correct
2 Correct 3 ms 4172 KB Output is correct
3 Correct 8 ms 5260 KB Output is correct
4 Correct 6 ms 5216 KB Output is correct
5 Correct 6 ms 5196 KB Output is correct
6 Correct 6 ms 5324 KB Output is correct
7 Correct 7 ms 5324 KB Output is correct
8 Correct 5 ms 4172 KB Output is correct
9 Correct 3 ms 4172 KB Output is correct
10 Correct 3 ms 4172 KB Output is correct
11 Correct 7 ms 5196 KB Output is correct
12 Correct 97 ms 5196 KB Output is correct
13 Correct 3 ms 4172 KB Output is correct
14 Correct 177 ms 5324 KB Output is correct
15 Correct 3 ms 4172 KB Output is correct
16 Correct 10 ms 5264 KB Output is correct
17 Correct 3 ms 4172 KB Output is correct
18 Correct 10 ms 5452 KB Output is correct
19 Correct 5 ms 4172 KB Output is correct
20 Correct 5 ms 5068 KB Output is correct
21 Correct 5 ms 5068 KB Output is correct
22 Correct 4 ms 4172 KB Output is correct
23 Correct 7 ms 5324 KB Output is correct
24 Correct 4 ms 4172 KB Output is correct
25 Correct 7 ms 5324 KB Output is correct
26 Correct 10 ms 5196 KB Output is correct
27 Correct 9 ms 5248 KB Output is correct
28 Correct 7 ms 5280 KB Output is correct
29 Correct 8 ms 5196 KB Output is correct
30 Correct 46 ms 5324 KB Output is correct
31 Correct 9 ms 5344 KB Output is correct
32 Correct 34 ms 5324 KB Output is correct
33 Correct 8 ms 5352 KB Output is correct
34 Correct 8 ms 5324 KB Output is correct
35 Correct 6 ms 4684 KB Output is correct
36 Correct 6 ms 4684 KB Output is correct
37 Correct 5 ms 4712 KB Output is correct
38 Correct 5 ms 4556 KB Output is correct
39 Correct 5 ms 4556 KB Output is correct
40 Correct 8 ms 5580 KB Output is correct
41 Correct 5 ms 4556 KB Output is correct
42 Correct 8 ms 5580 KB Output is correct
43 Correct 8 ms 5580 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 4172 KB Output is correct
2 Correct 4 ms 4172 KB Output is correct
3 Correct 3 ms 4172 KB Output is correct
4 Correct 4 ms 4232 KB Output is correct
5 Correct 3 ms 4172 KB Output is correct
6 Correct 4 ms 4224 KB Output is correct
7 Correct 3 ms 4172 KB Output is correct
8 Correct 3 ms 4172 KB Output is correct
9 Correct 3 ms 4172 KB Output is correct
10 Correct 3 ms 4172 KB Output is correct
11 Correct 1253 ms 27740 KB Output is correct
12 Correct 4 ms 4172 KB Output is correct
13 Correct 316 ms 27696 KB Output is correct
14 Correct 3 ms 4172 KB Output is correct
15 Correct 1244 ms 27736 KB Output is correct
16 Correct 430 ms 27740 KB Output is correct
17 Correct 312 ms 27660 KB Output is correct
18 Correct 511 ms 27736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4172 KB Output is correct
2 Correct 3 ms 4172 KB Output is correct
3 Correct 8 ms 5260 KB Output is correct
4 Correct 6 ms 5216 KB Output is correct
5 Correct 6 ms 5196 KB Output is correct
6 Correct 6 ms 5324 KB Output is correct
7 Correct 7 ms 5324 KB Output is correct
8 Correct 5 ms 4172 KB Output is correct
9 Correct 3 ms 4172 KB Output is correct
10 Correct 3 ms 4172 KB Output is correct
11 Correct 7 ms 5196 KB Output is correct
12 Correct 97 ms 5196 KB Output is correct
13 Correct 3 ms 4172 KB Output is correct
14 Correct 177 ms 5324 KB Output is correct
15 Correct 3 ms 4172 KB Output is correct
16 Correct 10 ms 5264 KB Output is correct
17 Correct 3 ms 4172 KB Output is correct
18 Correct 10 ms 5452 KB Output is correct
19 Correct 5 ms 4172 KB Output is correct
20 Correct 5 ms 5068 KB Output is correct
21 Correct 5 ms 5068 KB Output is correct
22 Correct 4 ms 4172 KB Output is correct
23 Correct 7 ms 5324 KB Output is correct
24 Correct 4 ms 4172 KB Output is correct
25 Correct 7 ms 5324 KB Output is correct
26 Correct 10 ms 5196 KB Output is correct
27 Correct 9 ms 5248 KB Output is correct
28 Correct 7 ms 5280 KB Output is correct
29 Correct 8 ms 5196 KB Output is correct
30 Correct 46 ms 5324 KB Output is correct
31 Correct 9 ms 5344 KB Output is correct
32 Correct 34 ms 5324 KB Output is correct
33 Correct 8 ms 5352 KB Output is correct
34 Correct 8 ms 5324 KB Output is correct
35 Correct 6 ms 4684 KB Output is correct
36 Correct 6 ms 4684 KB Output is correct
37 Correct 5 ms 4712 KB Output is correct
38 Correct 5 ms 4556 KB Output is correct
39 Correct 5 ms 4556 KB Output is correct
40 Correct 8 ms 5580 KB Output is correct
41 Correct 5 ms 4556 KB Output is correct
42 Correct 8 ms 5580 KB Output is correct
43 Correct 8 ms 5580 KB Output is correct
44 Correct 12 ms 6180 KB Output is correct
45 Correct 3 ms 4172 KB Output is correct
46 Correct 8 ms 5604 KB Output is correct
47 Correct 26 ms 6392 KB Output is correct
48 Correct 11 ms 5508 KB Output is correct
49 Correct 22 ms 6396 KB Output is correct
50 Correct 41 ms 6356 KB Output is correct
51 Correct 24 ms 8104 KB Output is correct
52 Correct 6 ms 5196 KB Output is correct
53 Execution timed out 3058 ms 8492 KB Time limit exceeded
54 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4172 KB Output is correct
2 Correct 3 ms 4172 KB Output is correct
3 Correct 8 ms 5260 KB Output is correct
4 Correct 6 ms 5216 KB Output is correct
5 Correct 6 ms 5196 KB Output is correct
6 Correct 6 ms 5324 KB Output is correct
7 Correct 7 ms 5324 KB Output is correct
8 Correct 5 ms 4172 KB Output is correct
9 Correct 3 ms 4172 KB Output is correct
10 Correct 3 ms 4172 KB Output is correct
11 Correct 7 ms 5196 KB Output is correct
12 Correct 97 ms 5196 KB Output is correct
13 Correct 3 ms 4172 KB Output is correct
14 Correct 177 ms 5324 KB Output is correct
15 Correct 3 ms 4172 KB Output is correct
16 Correct 10 ms 5264 KB Output is correct
17 Correct 3 ms 4172 KB Output is correct
18 Correct 10 ms 5452 KB Output is correct
19 Correct 5 ms 4172 KB Output is correct
20 Correct 5 ms 5068 KB Output is correct
21 Correct 5 ms 5068 KB Output is correct
22 Correct 4 ms 4172 KB Output is correct
23 Correct 7 ms 5324 KB Output is correct
24 Correct 4 ms 4172 KB Output is correct
25 Correct 7 ms 5324 KB Output is correct
26 Correct 10 ms 5196 KB Output is correct
27 Correct 9 ms 5248 KB Output is correct
28 Correct 7 ms 5280 KB Output is correct
29 Correct 8 ms 5196 KB Output is correct
30 Correct 46 ms 5324 KB Output is correct
31 Correct 9 ms 5344 KB Output is correct
32 Correct 34 ms 5324 KB Output is correct
33 Correct 8 ms 5352 KB Output is correct
34 Correct 8 ms 5324 KB Output is correct
35 Correct 6 ms 4684 KB Output is correct
36 Correct 6 ms 4684 KB Output is correct
37 Correct 5 ms 4712 KB Output is correct
38 Correct 5 ms 4556 KB Output is correct
39 Correct 5 ms 4556 KB Output is correct
40 Correct 8 ms 5580 KB Output is correct
41 Correct 5 ms 4556 KB Output is correct
42 Correct 8 ms 5580 KB Output is correct
43 Correct 8 ms 5580 KB Output is correct
44 Correct 3 ms 4172 KB Output is correct
45 Correct 111 ms 21660 KB Output is correct
46 Correct 2248 ms 16340 KB Output is correct
47 Correct 129 ms 23656 KB Output is correct
48 Correct 87 ms 23644 KB Output is correct
49 Correct 36 ms 15932 KB Output is correct
50 Execution timed out 3063 ms 29652 KB Time limit exceeded
51 Halted 0 ms 0 KB -