結果
問題 | No.488 四角関係 |
ユーザー |
![]() |
提出日時 | 2017-03-08 04:24:43 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 1,383 bytes |
コンパイル時間 | 955 ms |
コンパイル使用メモリ | 104,312 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 20:51:15 |
合計ジャッジ時間 | 1,740 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
#include<cstdio>#include<cstdlib>#include<cstring>#include<cmath>#include<ctime>#include<cctype>#include<climits>#include<iostream>#include<string>#include<vector>#include<map>#include<list>#include<queue>#include<deque>#include<algorithm>#include<numeric>#include<utility>#include<complex>#include<memory>#include<functional>using namespace std;long pow_mod(long x, long y, long mod) {long tmp = 1;x %= mod;if (y > 0) {tmp = pow_mod(x, y / 2, mod);if (y % 2) {tmp = (((tmp * tmp) % mod) * x) % mod;} else {tmp = (tmp * tmp) % mod;}}return tmp;}int main() {cin.tie(0);ios::sync_with_stdio(false);int n, m;cin >> n >> m;int a, b;vector<vector<int>> ab(n,vector<int>(n));for (int i = 0; i < m; i++) {cin >> a >> b;ab[a][b] = ab[b][a] = 1;}int ans = 0;for (int i = 0; i < n; i++) {for (int j = i + 1; j < n; j++) {for (int k = j + 1; k < n; k++) {for (int l = k + 1; l < n; l++) {int x = ab[i][j] + ab[i][k] + ab[i][l];int xx = ab[j][i] + ab[j][k] + ab[j][l];int xxx = ab[k][i] + ab[k][j] + ab[k][l];int xxxx = ab[l][i] + ab[l][j] + ab[l][k];if (x == 2 && xx == 2 && xxx == 2 && xxxx == 2) {ans++;}}}}}cout << ans << endl;return 0;}