結果
問題 |
No.1147 土偶Ⅱ
|
ユーザー |
|
提出日時 | 2020-08-06 04:13:48 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 500 ms |
コード長 | 519 bytes |
コンパイル時間 | 2,948 ms |
コンパイル使用メモリ | 191,932 KB |
最終ジャッジ日時 | 2025-01-12 15:14:47 |
ジャッジサーバーID (参考情報) |
judge4 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:8:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | int n,m; scanf("%d%d",&n,&m); | ~~~~~^~~~~~~~~~~~~~ main.cpp:11:31: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | int u,v; scanf("%d%d",&u,&v); u--; v--; | ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i=0;i<(n);i++) using namespace std; int main(){ int n,m; scanf("%d%d",&n,&m); bool A[100][100]={}; rep(i,m){ int u,v; scanf("%d%d",&u,&v); u--; v--; A[u][v]=A[v][u]=true; } bool B[100][100]={}; rep(u,n) rep(v,n) { B[u][v]=true; rep(w,n) if(A[u][w] && A[w][v]) B[u][v]=false; if(A[u][v]) B[u][v]=true; } int ans=0; rep(u,n) for(int v=u+1;v<n;v++) for(int w=v+1;w<n;w++) if(B[u][v] && B[u][w] && B[v][w]) ans++; printf("%d\n",ans); return 0; }