Submission #710448

#TimeUsernameProblemLanguageResultExecution timeMemory
710448myrcellaThousands Islands (IOI22_islands)C++17
Compilation error
0 ms0 KiB
//by szh #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pii pair<int,int> #define pll pair<long long,long long> #define pb push_back #define debug(x) cerr<<#x<<"="<<x<<endl #define pq priority_queue #define inf 0x3f #define rep(i,a,b) for (int i=a;i<(b);i++) #define MP make_pair #define SZ(x) (int(x.size())) #define ll long long #define mod 1000000007 #define ALL(x) x.begin(),x.end() void inc(int &a,int b) {a=(a+b)%mod;} void dec(int &a,int b) {a=(a-b+mod)%mod;} int lowbit(int x) {return x&(-x);} ll p0w(ll base,ll p) {ll ret=1;while(p>0){if (p%2ll==1ll) ret=ret*base%mod;base=base*base%mod;p/=2ll;}return ret;} #include "islands.h" #include <variant> #include <vector> const int maxn = 1010; int dis[maxn][maxn]; vector <int> pos; vector <int> cyc; std::variant<bool, std::vector<int>> find_journey( int n, int M, std::vector<int> U, std::vector<int> V) { rep(i,0,M) { dis[U[i]][V[i]] = 1; if (U[i]==0) pos.pb(V[i]); } rep(k,0,n) rep(i,0,n) rep(j,0,n) { dis[i][j]|=(dis[i][k]&dis[k][j]); } rep(i,0,n) if (dis[i][i]==1) cyc.pb(i); vector <int> ret; rep(i,0,SZ(pos)) rep(j,0,i) for (int k:cyc) { if (dis[pos[i]][k] and dis[pos[j]][k]) return ret; } return false; } int main() { int N, M; assert(2 == scanf("%d %d", &N, &M)); std::vector<int> U(M), V(M); for (int i = 0; i < M; ++i) { assert(2 == scanf("%d %d", &U[i], &V[i])); } std::variant<bool, std::vector<int>> result = find_journey(N, M, U, V); if (result.index() == 0) { printf("0\n"); if (std::get<bool>(result)) { printf("1\n"); } else { printf("0\n"); } } else { printf("1\n"); std::vector<int> &canoes = std::get<std::vector<int>>(result); printf("%d\n", static_cast<int>(canoes.size())); for (int i = 0; i < static_cast<int>(canoes.size()); ++i) { if (i > 0) { printf(" "); } printf("%d", canoes[i]); } printf("\n"); } return 0; }

Compilation message (stderr)

/usr/bin/ld: /tmp/ccHcethG.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccbyGfPF.o:islands.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status