QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#668955#8333. Gifthuan_yp#Compile Error//C++141.3kb2024-10-23 16:45:082024-10-23 16:45:11

Judging History

你现在查看的是最新测评结果

  • [2024-10-23 16:45:11]
  • 评测
  • [2024-10-23 16:45:08]
  • 提交

answer

#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
const int N=2e5+10;
vector<int> e[N];
int fa[N], deg[N], cnt[10];
vector<int> cycle;
void dfs(int u){
    for(auto v:e[u]){
        if(v==fa[u])continue;
        if(fa[v]!=-1){
            if(cycle.size())continue;
            int x=u;
            // cerr << "S:" << v << '\n';
            cycle.push_back(v);
            while(x!=v){
                // cerr << x << '\n';
                // Sleep(1000);
                cycle.push_back(x);
                x=fa[x];
            }
            continue;
        }
        fa[v]=u;
        dfs(v);
    }
}
int main(){
    int n;
    cin>>n;
    memset(fa,-1,sizeof(fa));
    fa[1]=0;
    for(int i=1;i<=n;i++){
        int x,y;cin>>x>>y;
        deg[x]++,deg[y]++;
        e[x].push_back(y),e[y].push_back(x);
    }
    dfs(1);
    long long ans=0;
    for(int i=1;i<=n;i++){
        cnt[deg[i]]++;
    }
    cycle.push_back(cycle[0]);
    for(int i=0; i<cycle.size()-1; i++){
        int u=cycle[i], v=cycle[i+1];
        cnt[deg[u]]--, cnt[deg[v]]--;
        cnt[deg[u]-1]++, cnt[deg[v]-1]++;
        if(cnt[5]==0){
            ans += cnt[3] + cnt[2] + cnt[1];
        }
        cnt[deg[u]-1]--, cnt[deg[v]-1]--;
        cnt[deg[u]]++, cnt[deg[v]]++;
        
    }
    cout << ans << '\n';
    return 0;
}

詳細信息

answer.code:2:9: fatal error: windows.h: No such file or directory
    2 | #include<windows.h>
      |         ^~~~~~~~~~~
compilation terminated.