Submission #430139

# Submission time Handle Problem Language Result Execution time Memory
430139 2021-06-16T11:41:30 Z Ruba_K Duathlon (APIO18_duathlon) C++14
0 / 100
72 ms 8960 KB
#include<bits/stdc++.h>
/*
Created By Tornado2004
*/
using namespace std;

#define debug(x) cout << '[' << #x << " is: " << x << "] " << endl;
#define imod(a , n) (a % n + n ) % n

#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define inF freopen("wormsort.in","r",stdin );
#define outF freopen("wormsort.out" , "w" , stdout ) ;
#define sor(v) sort(v.begin() , v.end());
#define print(v) for(auto f : v ) cout << f << " " ;
#define rsor(v) sort(v.rbegin() , v.rend());
#define rev(v) reverse(v.begin() , v.end());
#define scan(v)for(auto &it : v)cin >> it ;

#define ll long long
//#define int ll
#define logar(x , y) log(x) / log(y)
#define __sum(n) n * (n + 1) / 2
#define __lcm(a , b) a / __gcd(a , b) * b
#define pii pair<int , int >
const int N = 2e5 + 3 , K = 11 , M = N * 4 ;
const ll MOD = 998244353 , oo = 1e9 , OO = 1e18 , mod = MOD ;
const double pi = acos(-1) , eps = 1e-17 ;

//37
// (a ^ b / c ) % mod = (a ^ b ) % MOD * (c ^ (mod - 2)) % mod
// m is prime --> (a ^ m) % m = a % m


vector<int> adj[N];

int32_t main()
{   //inF;
   //i bnF;outF;
    fastio;

    int n , m ;
    cin >> n >> m ;

    for(int i = 0 ; i < m ; i ++){
        int a , b;
        cin >>a >> b;


        adj[a].push_back(b);
        adj[b].push_back(a);

    }
    if(n < 2)cout << 0 ;
    else {


            if(m == n - 1){
            ll ans = 0 ;

            for(int i = 2 ; i < n ; i ++)
                ans += (i - 1) * (n - i);

            ans *=2 ;
            cout << ans ;

            }
            else cout << (2 * (n - 1) * (n - 1));

    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 4940 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 4940 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 72 ms 8960 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 4940 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 51 ms 8904 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 5024 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 47 ms 8956 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 4940 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 4940 KB Output isn't correct
2 Halted 0 ms 0 KB -