Submission #574764

# Submission time Handle Problem Language Result Execution time Memory
574764 2022-06-09T11:45:12 Z Uzouf Carnival (CEOI14_carnival) C++14
20 / 100
116 ms 560 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
//#define endl "\n"
int mod=1e9+7;
const int N=2e5+5;
template<class x>
using ordered_multiset = tree<x, null_type,less_equal<x>, rb_tree_tag,tree_order_statistics_node_update>;

int n,c;
vector<vector<int> > v(155);
bool vis[155];
map<int,int> col;

void dfs(int i) {
  vis[i]=true;
  col[i]=c;
  for (int j:v[i]) {
    if (!vis[j]) dfs(j);
  }
}

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    //freopen(".in", "r", stdin); freopen(".out", "w", stdout);

    cin>>n;
    for (int i=1;i<=n;i++) {
      for (int j=i+1;j<=n;j++) {
        cout<<2<<' '<<i<<' '<<j<<endl;
        fflush(stdout);

        int df; cin>>df;
        if (df==1) {
          v[i].push_back(j);
          v[j].push_back(i);
        }
      }
    }

    for (int i=1;i<=n;i++) {
      if (!vis[i]) {
        c++;
        dfs(i);
      }
    }

    cout<<0<<' ';
    for(int i=1;i<=n;i++) {
      cout<<col[i]<<' ';
    }
}
# Verdict Execution time Memory Grader output
1 Partially correct 80 ms 328 KB Partially correct
2 Partially correct 89 ms 300 KB Partially correct
3 Partially correct 79 ms 300 KB Partially correct
4 Partially correct 81 ms 296 KB Partially correct
5 Partially correct 69 ms 384 KB Partially correct
6 Partially correct 76 ms 452 KB Partially correct
7 Partially correct 84 ms 312 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 68 ms 336 KB Partially correct
2 Partially correct 116 ms 424 KB Partially correct
3 Partially correct 40 ms 304 KB Partially correct
4 Partially correct 73 ms 296 KB Partially correct
5 Partially correct 77 ms 328 KB Partially correct
6 Partially correct 39 ms 440 KB Partially correct
7 Partially correct 82 ms 560 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 60 ms 340 KB Partially correct
2 Partially correct 92 ms 320 KB Partially correct
3 Partially correct 44 ms 296 KB Partially correct
4 Partially correct 69 ms 300 KB Partially correct
5 Partially correct 86 ms 320 KB Partially correct
6 Partially correct 94 ms 368 KB Partially correct
7 Partially correct 83 ms 308 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 88 ms 448 KB Partially correct
2 Partially correct 50 ms 316 KB Partially correct
3 Partially correct 100 ms 308 KB Partially correct
4 Partially correct 81 ms 312 KB Partially correct
5 Partially correct 44 ms 320 KB Partially correct
6 Partially correct 89 ms 320 KB Partially correct
7 Partially correct 88 ms 328 KB Partially correct
# Verdict Execution time Memory Grader output
1 Partially correct 95 ms 396 KB Partially correct
2 Partially correct 61 ms 320 KB Partially correct
3 Partially correct 95 ms 300 KB Partially correct
4 Partially correct 87 ms 296 KB Partially correct
5 Partially correct 97 ms 312 KB Partially correct
6 Partially correct 90 ms 308 KB Partially correct
7 Partially correct 66 ms 308 KB Partially correct