제출 #1260440

#제출 시각아이디문제언어결과실행 시간메모리
1260440minggaRack (eJOI19_rack)C++20
40 / 100
0 ms328 KiB
// Author: caption_mingle #include "bits/stdc++.h" using namespace std; #define ln "\n" #define pb push_back #define fi first #define se second #define all(x) (x).begin(), (x).end() #define sz(x) ((int)(x).size()) #define int long long const int mod = 1e9 + 7; const int inf = 2e9; const int N = 1e6 + 7; int n, k, p[N]; int add(int x, int y) { x += y; if(x >= mod) x -= mod; return x; } signed main() { cin.tie(0) -> sync_with_stdio(0); #define task "" if(fopen(task ".INP", "r")) { freopen(task ".INP", "r", stdin); freopen(task ".OUT", "w", stdout); } cin >> n >> k; p[0] = 1; for(int i = 1; i <= n; i++) p[i] = add(p[i - 1], p[i - 1]); int st = 1; if(n - 1 <= 63 and (1 << (n - 1)) < k) { k -= (1 << (n - 1)); st = 2; } if(k == 1) { cout << st; return 0; } k--; for(int i = 0; i <= n; i++) { if(k >> i & 1) { st = add(st, p[n - i - 1]); } } cout << st; cerr << "\nTime: " << clock() * 1000 / CLOCKS_PER_SEC; }

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

rack.cpp: In function 'int main()':
rack.cpp:28:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |                 freopen(task ".INP", "r", stdin);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
rack.cpp:29:24: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |                 freopen(task ".OUT", "w", stdout);
      |                 ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...