QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#645174#8333. GiftDong_Nan_Zhi#Compile Error//C++171.0kb2024-10-16 17:09:002024-10-16 17:09:01

Judging History

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

  • [2024-10-16 17:09:01]
  • 评测
  • [2024-10-16 17:09:00]
  • 提交

answer

#include<bits/stdc++.h>
#define x first
#define y second
#define int long long 

using namespace std;
typedef pair<int,int> PII;
const int N = 1e5 + 10;

int n;
int p[N];
PII e[N];
int st[N];

int main(){
    cin >> n;
    for(int i = 1;i <= n; i ++)
    {
        int a,b;
        cin>>a>>b;
        p[a] ++,p[b] ++;
        e[i].x = a,e[i].y = b;
    }

    int cnt = 0,ans = 0;
    int flag = 0,cc = 0;
    for(int i = 1; i <= n; i ++)
    {
        //if(p[i] <= 3) cnt ++;
        if(p[i] == 4) cc ++,st[i] = 1;
        if(p[i] == 5) flag ++;
    }
    
    for(int i = 1; i <= n; i ++)
    {
        int f = flag;
        int c = cc;
        int a = e[i].x,b = e[i].y;
        f -= (p[a] == 5) + (p[b] == 5);
        if(p[a] == 1 || p[b] == 1) continue;
        int x = p[a] - 1,y = p[b] - 1;
        //if()
        c -= st[a] + st[b];
        int s = n - c - (x == 4) - (y == 4);
//        cout<<s<<endl;
        if(f == 0)
            ans += s;
    }

    cout<<ans<<endl;

}

Details

cc1plus: error: ‘::main’ must return ‘int’