제출 #440800

#제출 시각아이디문제언어결과실행 시간메모리
440800hhhhauraAmusement Park (CEOI19_amusementpark)C++14
19 / 100
199 ms17232 KiB
#define wiwihorz #include <bits/stdc++.h> #pragma GCC optimize("Ofast") #pragma loop-opt(on) #define rep(i, a, b) for(int i = a; i <= b; i++) #define rrep(i, a, b) for(int i = b; i >= a; i--) #define all(x) x.begin(), x.end() #define ceil(a, b) ((a + b - 1) / (b)) #define INF 1000000000000000000 #define MOD 998244353 #define eps (1e-9) using namespace std; #define int long long int #define lld long double #define pii pair<int, int> #define random mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()) #ifdef wiwihorz #define print(a...) kout("[" + string(#a) + "] = ", a) void vprint(auto L, auto R) {while(L < R) cerr << *L << " \n"[next(L) == R], ++L;} void kout() { cerr << endl; } template<class T1, class ... T2> void kout(T1 a, T2 ... e) { cerr << a << " ", kout(e...); } #else #define print(...) 0 #define vprint(...) 0 #endif namespace solver { int n, m, cur; vector<vector<int>> mp; vector<pii> es; set<int> s; void init_(int _n, int _m) { n = _n, m = _m; s.clear(); es.clear(); } void add_edge(int a, int b) { es.push_back({a, b}); } int solve() { int ans = 0; vector<int> a(n, 0), id(n + 1, 0); rep(i, 1, n) a[i - 1] = i; do { rep(i, 0, n - 1) id[a[i]] = i + 1; int msk = 0; rep(i, 0, m - 1) { pii cur = es[i]; if(id[cur.first] < id[cur.second]) { msk |= ((int) 1 << i ); } } if(s.find(msk) == s.end()) { ans = (ans + __builtin_popcount(msk)) % MOD; s.insert(msk); } } while(next_permutation(all(a))); return ans; } }; using namespace solver; signed main() { ios::sync_with_stdio(false), cin.tie(0); int n, m; cin >> n >> m; init_(n, m); rep(i, 1, m) { int a, b; cin >> a >> b; add_edge(a, b); } cout << solve() << "\n"; return 0; }

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

amusementpark.cpp:4: warning: ignoring '#pragma loop ' [-Wunknown-pragmas]
    4 | #pragma loop-opt(on)
      | 
amusementpark.cpp:24:13: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   24 | void vprint(auto L, auto R) {while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
      |             ^~~~
amusementpark.cpp:24:21: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   24 | void vprint(auto L, auto R) {while(L < R) cerr << *L << " \n"[next(L) == R], ++L;}
      |                     ^~~~
#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...