제출 #1124603

#제출 시각아이디문제언어결과실행 시간메모리
1124603Zero_OPNoM (RMI21_nom)C++20
9 / 100
266 ms440 KiB
#include <bits/stdc++.h> using namespace std; #define rep(i, l, r) for(int i = (l); i < (r); ++i) #define sz(v) (int)v.size() #define dbg(x) "[" #x " = " << (x) << "]" #define all(v) begin(v), end(v) #define compact(v) v.erase(unique(all(v)), end(v)) #define file(name) if(fopen(name".inp", "r")){ freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); } template<typename T> bool minimize(T& a, const T& b){ if(a > b){ return a = b, true; } return false; } template<typename T> bool maximize(T& a, const T& b){ if(a < b){ return a = b, true; } return false; } mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); using ll = long long; using ld = long double; using ull = unsigned long long; using vi = vector<int>; using vl = vector<ll>; const int mod = 1e9 + 7; int N, M; namespace subtask1{ bool check(){ return N <= 5 && M <= 5; } void solve(){ vector<int> perm(2 * N); iota(all(perm), 0); int ans = 0; do{ vector<int> lst(N, -1); bool ok = true; for(int i = 0; i < 2 * N; ++i){ int x = perm[i] % N; if(lst[x] == -1) lst[x] = i; else if(abs(lst[x] - i) % M == 0){ ok = false; break; } } ans += ok; } while(next_permutation(all(perm))); cout << ans << '\n'; } } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); file("A"); cin >> N >> M; if(subtask1::check()) return subtask1::solve(), 0; return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:10:55: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 | #define file(name) if(fopen(name".inp", "r")){ freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
      |                                                ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:71:5: note: in expansion of macro 'file'
   71 |     file("A");
      |     ^~~~
Main.cpp:10:88: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 | #define file(name) if(fopen(name".inp", "r")){ freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout); }
      |                                                                                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:71:5: note: in expansion of macro 'file'
   71 |     file("A");
      |     ^~~~
#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...