제출 #135122

#제출 시각아이디문제언어결과실행 시간메모리
135122Lawliet철인 이종 경기 (APIO18_duathlon)C++14
5 / 100
1069 ms2040 KiB
#include <bits/stdc++.h> #define MAX 100010 using namespace std; typedef long long int lli; int n, m; int n1, n2; lli ans; lli can; lli marc; lli grafo[MAX]; stack<int> s; bool bit(lli v, int i) { if(v & (1LL << i)) return true; return false; } void DFS(int i, int t) { if(i == t) { //printf("oi\n"); while(!s.empty()) { if(!bit(can , s.top())) can += (1LL << s.top()); //printf("can = %d\n",can); s.pop(); } return; } if(!bit(marc , i)) s.push( i ); marc += (1LL << i); lli aux = grafo[i]; while(aux != 0) { lli prox = aux&-aux; aux -= prox; float l = log2(prox); int p = l; if(bit(marc , p)) continue; DFS(p , t); } if(bit(marc,i)) marc -= (1LL << i); if(!s.empty() && s.top() == i) s.pop(); } int main() { scanf("%d %d",&n,&m); for(int g = 0 ; g < m ; g++) { scanf("%d %d",&n1,&n2); grafo[n1] += (1LL << n2); grafo[n2] += (1LL << n1); } for(int s = 1 ; s <= n ; s++) { for(int t = s + 1 ; t <= n ; t++) { DFS(s , t); //printf("i =%d %d\n",s,t); ans += __builtin_popcountll(can); if(bit(can , s)) ans--; if(bit(can , t)) ans--; //printf("\n\n"); //printf("ans = %lld\n",ans); can = 0; //memset(can , false , sizeof(can)); } //printf("---- %lld\n",ans); //printf("\n\n"); } printf("%lld\n",2*ans); }

컴파일 시 표준 에러 (stderr) 메시지

count_triplets.cpp: In function 'int main()':
count_triplets.cpp:72:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~~
count_triplets.cpp:76:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d",&n1,&n2);
   ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...