Submission #981536

# Submission time Handle Problem Language Result Execution time Memory
981536 2024-05-13T10:06:09 Z vjudge1 Duathlon (APIO18_duathlon) C++17
5 / 100
1000 ms 2264 KB
#include <bits/stdc++.h>
 
#pragma optimize("Ofast")
#pragma target("avx2")
 
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define mem(a,i) memset(a,i,sizeof(a))
#define sz(s) (int)s.size()
#define y1 yy
#define ppb pop_back
#define lb lower_bound
#define ub upper_bound
#define gcd(a,b) __gcd(a,b)
#define in insert
#define int ll

const int MAX=1e5+15;
const int B=300;
const int N=104;
const int block=400;
const int maxB=MAX/B+10;
const ll inf=2e18;  
const int mod=998244353;
const int mod1=1e9+9;
const ld eps=1e-9;
 
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,-1,1,-1};
 
int binpow(int a,int n){
  if(!n)return 1;
  if(n%2==1)return a*binpow(a,n-1)%mod;
  int k=binpow(a,n/2);
  return k*k%mod;
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n,m;
int g[20][20];
int use[20][20][20];

void solve(){
  cin>>n>>m;
  vector<int> vec;
  for(int i=1;i<=n;i++){
    vec.pb(i);
  }
  for(int i=1;i<=m;i++){
    int a,b;
    cin>>a>>b;
    g[a][b]=g[b][a]=1;
  }
  do{
    int r=0;
    for(int i=1;i<sz(vec);i++){
      if(g[vec[i]][vec[i-1]])r++;
      else break;
    }
    for(int i=0;i<=r;i++){
      for(int j=i+1;j<=r;j++){
        for(int k=j+1;k<=r;k++){
          use[vec[i]][vec[j]][vec[k]]=1;
        }
      }
    }
  }while(next_permutation(all(vec)));
  int ans=0;
  for(int i=1;i<=n;i++){
    for(int j=1;j<=n;j++){
      if(i==j)continue;
      for(int k=1;k<=n;k++){
        if(k==i||k==j)continue;
        ans+=use[i][j][k];
      }
    }
  }
  cout<<ans;
}
 
signed main(){
  //  freopen("help.in","r",stdin);
  //  freopen("help.out","w",stdout);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  // prec();
  int t=1;
  // cin>>t;
  while(t--)solve();
}

Compilation message

count_triplets.cpp:3: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    3 | #pragma optimize("Ofast")
      | 
count_triplets.cpp:4: warning: ignoring '#pragma target ' [-Wunknown-pragmas]
    4 | #pragma target("avx2")
      |
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 15 ms 348 KB Output is correct
7 Correct 18 ms 348 KB Output is correct
8 Correct 24 ms 496 KB Output is correct
9 Correct 62 ms 348 KB Output is correct
10 Correct 662 ms 468 KB Output is correct
11 Correct 23 ms 344 KB Output is correct
12 Correct 18 ms 496 KB Output is correct
13 Correct 23 ms 348 KB Output is correct
14 Correct 18 ms 464 KB Output is correct
15 Correct 24 ms 348 KB Output is correct
16 Correct 18 ms 348 KB Output is correct
17 Correct 18 ms 348 KB Output is correct
18 Correct 18 ms 348 KB Output is correct
19 Correct 20 ms 596 KB Output is correct
20 Correct 16 ms 344 KB Output is correct
21 Correct 15 ms 348 KB Output is correct
22 Correct 20 ms 856 KB Output is correct
23 Correct 3 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
26 Correct 19 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 2 ms 348 KB Output is correct
29 Correct 18 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 3 ms 348 KB Output is correct
32 Correct 19 ms 348 KB Output is correct
33 Correct 2 ms 348 KB Output is correct
34 Correct 2 ms 348 KB Output is correct
35 Correct 19 ms 476 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 15 ms 348 KB Output is correct
7 Correct 18 ms 348 KB Output is correct
8 Correct 24 ms 496 KB Output is correct
9 Correct 62 ms 348 KB Output is correct
10 Correct 662 ms 468 KB Output is correct
11 Correct 23 ms 344 KB Output is correct
12 Correct 18 ms 496 KB Output is correct
13 Correct 23 ms 348 KB Output is correct
14 Correct 18 ms 464 KB Output is correct
15 Correct 24 ms 348 KB Output is correct
16 Correct 18 ms 348 KB Output is correct
17 Correct 18 ms 348 KB Output is correct
18 Correct 18 ms 348 KB Output is correct
19 Correct 20 ms 596 KB Output is correct
20 Correct 16 ms 344 KB Output is correct
21 Correct 15 ms 348 KB Output is correct
22 Correct 20 ms 856 KB Output is correct
23 Correct 3 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
26 Correct 19 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 2 ms 348 KB Output is correct
29 Correct 18 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 3 ms 348 KB Output is correct
32 Correct 19 ms 348 KB Output is correct
33 Correct 2 ms 348 KB Output is correct
34 Correct 2 ms 348 KB Output is correct
35 Correct 19 ms 476 KB Output is correct
36 Execution timed out 1034 ms 348 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 2264 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 2264 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 2264 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 15 ms 348 KB Output is correct
7 Correct 18 ms 348 KB Output is correct
8 Correct 24 ms 496 KB Output is correct
9 Correct 62 ms 348 KB Output is correct
10 Correct 662 ms 468 KB Output is correct
11 Correct 23 ms 344 KB Output is correct
12 Correct 18 ms 496 KB Output is correct
13 Correct 23 ms 348 KB Output is correct
14 Correct 18 ms 464 KB Output is correct
15 Correct 24 ms 348 KB Output is correct
16 Correct 18 ms 348 KB Output is correct
17 Correct 18 ms 348 KB Output is correct
18 Correct 18 ms 348 KB Output is correct
19 Correct 20 ms 596 KB Output is correct
20 Correct 16 ms 344 KB Output is correct
21 Correct 15 ms 348 KB Output is correct
22 Correct 20 ms 856 KB Output is correct
23 Correct 3 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
26 Correct 19 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 2 ms 348 KB Output is correct
29 Correct 18 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 3 ms 348 KB Output is correct
32 Correct 19 ms 348 KB Output is correct
33 Correct 2 ms 348 KB Output is correct
34 Correct 2 ms 348 KB Output is correct
35 Correct 19 ms 476 KB Output is correct
36 Execution timed out 1034 ms 348 KB Time limit exceeded
37 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 15 ms 348 KB Output is correct
7 Correct 18 ms 348 KB Output is correct
8 Correct 24 ms 496 KB Output is correct
9 Correct 62 ms 348 KB Output is correct
10 Correct 662 ms 468 KB Output is correct
11 Correct 23 ms 344 KB Output is correct
12 Correct 18 ms 496 KB Output is correct
13 Correct 23 ms 348 KB Output is correct
14 Correct 18 ms 464 KB Output is correct
15 Correct 24 ms 348 KB Output is correct
16 Correct 18 ms 348 KB Output is correct
17 Correct 18 ms 348 KB Output is correct
18 Correct 18 ms 348 KB Output is correct
19 Correct 20 ms 596 KB Output is correct
20 Correct 16 ms 344 KB Output is correct
21 Correct 15 ms 348 KB Output is correct
22 Correct 20 ms 856 KB Output is correct
23 Correct 3 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 2 ms 348 KB Output is correct
26 Correct 19 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 2 ms 348 KB Output is correct
29 Correct 18 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 3 ms 348 KB Output is correct
32 Correct 19 ms 348 KB Output is correct
33 Correct 2 ms 348 KB Output is correct
34 Correct 2 ms 348 KB Output is correct
35 Correct 19 ms 476 KB Output is correct
36 Execution timed out 1034 ms 348 KB Time limit exceeded
37 Halted 0 ms 0 KB -