Submission #20347

#TimeUsernameProblemLanguageResultExecution timeMemory
20347admin초음속철도 (OJUZ11_rail)C++14
10 / 100
145 ms368 KiB
#include <bits/stdc++.h> using namespace std; typedef long long lint; typedef pair<lint, lint> pi; int n, m, s[22], e[22]; int main(){ cin >> n >> m; for(int i=0; i<m; i++){ cin >>s[i]>>e[i]; } if(n > 20 || m > 20){ puts("0"); return 0; } if(n == 1) assert(0); int ans = 0; for(int i=0; i<(1<<m); i++){ int dx[22] = {}; int ok = 1; for(int j=0; j<m; j++){ if((i >> j) & 1){ dx[s[j]]++; dx[e[j]]--; } } for(int i=1; i<n; i++){ dx[i] += dx[i-1]; if(!dx[i]) ok = 0; } if(ok) ans++; } cout << ans; }
#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...