Submission #41734253
Source Code Expand
Copy
#pragma GCC optimize(2)#include<bits/stdc++.h>#define endl '\n'using namespace std;using ll=long long;int a[50][50];signed main() {ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);int n,m;cin>>n>>m;for(int i=0;i<m;++i)for(int j=0;j<n;++j)cin>>a[i][j];int ans=0;for(int x=1;x<=n;++x){for(int y=x+1;y<=n;++y){int f=1;for(int i=0;i<m;++i){for(int j=1;j<n;++j){if(a[i][j]==x&&a[i][j-1]==y)f=0;if(a[i][j]==y&&a[i][j-1]==x)f=0;}}
#pragma GCC optimize(2) #include<bits/stdc++.h> #define endl '\n' using namespace std; using ll=long long; int a[50][50]; signed main() { ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); int n,m;cin>>n>>m; for(int i=0;i<m;++i)for(int j=0;j<n;++j)cin>>a[i][j]; int ans=0; for(int x=1;x<=n;++x){ for(int y=x+1;y<=n;++y){ int f=1; for(int i=0;i<m;++i){ for(int j=1;j<n;++j){ if(a[i][j]==x&&a[i][j-1]==y)f=0; if(a[i][j]==y&&a[i][j-1]==x)f=0; } } ans+=f; } } cout<<ans; return 0; } // init? // var->0? // infinite dfs? // out of bound? // max_element / min_element?
Submission Info
Submission Time | |
---|---|
Task | B - Discord |
User | wa_wa_vegetable |
Language | C++ (GCC 9.2.1) |
Score | 200 |
Code Size | 753 Byte |
Status | AC |
Exec Time | 11 ms |
Memory | 3676 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_small_00.txt, 01_small_01.txt, 01_small_02.txt, 01_small_03.txt, 01_small_04.txt, 02_rnd_00.txt, 02_rnd_01.txt, 02_rnd_02.txt, 03_same_00.txt, 03_same_01.txt, 03_same_02.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 6 ms | 3676 KB |
00_sample_01.txt | AC | 2 ms | 3572 KB |
00_sample_02.txt | AC | 2 ms | 3636 KB |
01_small_00.txt | AC | 2 ms | 3528 KB |
01_small_01.txt | AC | 3 ms | 3520 KB |
01_small_02.txt | AC | 2 ms | 3556 KB |
01_small_03.txt | AC | 2 ms | 3472 KB |
01_small_04.txt | AC | 2 ms | 3592 KB |
02_rnd_00.txt | AC | 6 ms | 3600 KB |
02_rnd_01.txt | AC | 3 ms | 3540 KB |
02_rnd_02.txt | AC | 11 ms | 3540 KB |
03_same_00.txt | AC | 2 ms | 3516 KB |
03_same_01.txt | AC | 11 ms | 3540 KB |
03_same_02.txt | AC | 7 ms | 3476 KB |