Submission #839594

# Submission time Handle Problem Language Result Execution time Memory
839594 2023-08-30T10:13:58 Z kyaruru Pipes (CEOI15_pipes) Java 11
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

vector<int> adj[100001];
vector<int> tin(100001,-1),low(100001,-1);
vector<pii> ans;
bool vi[100001];
int t=0;


void dfs(int x,int p=-1){
    vi[x]=true;
    tin[x]=low[x]=t++;
    for(int u:adj[x]){
        if(u==p) continue;
        if(vi[u]){
            low[x]=min(low[x],tin[u]);
        }else{
            dfs(u,x);
            low[x]=min(low[x],low[u]);
            if(low[u]>tin[x]) cout<<u<<" "<<x<<endl;
        }
    }
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int a,b;
    cin>>a>>b;

    for(int i=0; i<b; i++){
        int x,y;
        cin>>x>>y;
        adj[x].push_back(y);
        adj[y].push_back(x);
    }

    for(int i=1; i<=a; i++){
        if(!vi[i]) dfs(i);
    }
}

Compilation message

pipes.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
pipes.java:1: error: class, interface, or enum expected
#include <bits/stdc++.h>
         ^
pipes.java:4: error: class, interface, or enum expected
typedef long long ll;
^
pipes.java:5: error: class, interface, or enum expected
typedef pair<int, int> pii;
^
pipes.java:6: error: class, interface, or enum expected
typedef pair<ll, ll> pll;
^
pipes.java:8: error: class, interface, or enum expected
vector<int> adj[100001];
^
pipes.java:9: error: class, interface, or enum expected
vector<int> tin(100001,-1),low(100001,-1);
^
pipes.java:10: error: class, interface, or enum expected
vector<pii> ans;
^
pipes.java:11: error: class, interface, or enum expected
bool vi[100001];
^
pipes.java:12: error: class, interface, or enum expected
int t=0;
^
pipes.java:15: error: class, interface, or enum expected
void dfs(int x,int p=-1){
^
pipes.java:17: error: class, interface, or enum expected
    tin[x]=low[x]=t++;
    ^
pipes.java:18: error: class, interface, or enum expected
    for(int u:adj[x]){
    ^
pipes.java:20: error: class, interface, or enum expected
        if(vi[u]){
        ^
pipes.java:22: error: class, interface, or enum expected
        }else{
        ^
pipes.java:24: error: class, interface, or enum expected
            low[x]=min(low[x],low[u]);
            ^
pipes.java:25: error: class, interface, or enum expected
            if(low[u]>tin[x]) cout<<u<<" "<<x<<endl;
            ^
pipes.java:26: error: class, interface, or enum expected
        }
        ^
pipes.java:32: error: class, interface, or enum expected
    cin.tie(0);
    ^
pipes.java:34: error: class, interface, or enum expected
    int a,b;
    ^
pipes.java:35: error: class, interface, or enum expected
    cin>>a>>b;
    ^
pipes.java:37: error: class, interface, or enum expected
    for(int i=0; i<b; i++){
    ^
pipes.java:37: error: class, interface, or enum expected
    for(int i=0; i<b; i++){
                 ^
pipes.java:37: error: class, interface, or enum expected
    for(int i=0; i<b; i++){
                      ^
pipes.java:39: error: class, interface, or enum expected
        cin>>x>>y;
        ^
pipes.java:40: error: class, interface, or enum expected
        adj[x].push_back(y);
        ^
pipes.java:41: error: class, interface, or enum expected
        adj[y].push_back(x);
        ^
pipes.java:42: error: class, interface, or enum expected
    }
    ^
pipes.java:44: error: class, interface, or enum expected
    for(int i=1; i<=a; i++){
                 ^
pipes.java:44: error: class, interface, or enum expected
    for(int i=1; i<=a; i++){
                       ^
pipes.java:46: error: class, interface, or enum expected
    }
    ^
31 errors