52 lines
829 B
C++
52 lines
829 B
C++
// https://codeforces.com/problemset/problem/104/C
|
|
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
using vi = vector<int>;
|
|
using ll = long long;
|
|
|
|
const int MAXN = 110;
|
|
vector<vi> g(MAXN);
|
|
bitset<MAXN> vis;
|
|
|
|
void dfs(int x){
|
|
vis[x]=1;
|
|
for(auto n: g[x]) if(!vis[n]) dfs(n);
|
|
}
|
|
|
|
void solve()
|
|
{
|
|
int n, m; cin >> n >> m;
|
|
|
|
for (int i=0;i<m;i++){
|
|
int u,v; cin>>u>>v;
|
|
g[u].push_back(v);
|
|
g[v].push_back(u);
|
|
}
|
|
|
|
if (n != m) {
|
|
cout << "OFFLINE" << endl;
|
|
return;
|
|
}
|
|
|
|
vis.reset();
|
|
dfs(1);
|
|
for (int i=1;i<=n;i++){
|
|
if (!vis[i]) {
|
|
cout << "OFFLINE" << endl;
|
|
return;
|
|
}
|
|
}
|
|
|
|
cout << "ONLINE" << endl;
|
|
|
|
return;
|
|
}
|
|
|
|
int main()
|
|
{
|
|
ios::sync_with_stdio(0);
|
|
cin.tie(0); cout.tie(0);
|
|
solve();
|
|
return 0;
|
|
} |