Submission #641292

#TimeUsernameProblemLanguageResultExecution timeMemory
641292YelarysRack (eJOI19_rack)C++17
40 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; typedef long double ld; typedef long long ll; typedef unsigned long long ull; #define pb push_back #define F first #define S second #define mp make_pair #define sz(x) (int)x.size() #define speed ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr) #define rep(i, a, b) for(int i = a; i < b; i++) #define pf push_front #define pb push_back #define all(x) x.begin(), x.end() #define pii pair<int, int> #define pll pair<long long, long long> #define vi vector<int> #define vll vector<long long> #define vpii vector<pair<int, int>> #define vpll vector<pair<long long, long long>> #define fl fflush(stdout) const ll INF = INT_MAX; const int N = (int)1e5 + 20; const ll mod = (ll)1e9 + 7; const int P = 31; ll binpow(ll a, int n){if(n == 0)return 1;if(n == 1)return a;ll r = binpow(a, n / 2) % mod;if(n % 2)return (((r * r) % mod) * a) % mod;return(r * r) % mod;} void setIO() { freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); } int dx[4] = {1, -1, 0, 0}; int dy[4] = {0, 0, 1, -1}; bool ans[10 * N]; void yela(){ ll n, k; cin >> n >> k; k--; for(int i = 0; i < min(62LL, n); i++){ ans[i] = k & (1LL << i); } reverse(ans, ans + n); ll sum = 0; for(int i = 0; i < n; i++){ if(ans[i]){ sum |= binpow(2, i); sum %= mod; } } sum++; cout << sum % mod; } int main(){ speed; int T = 1; //cin >> T; for(int i = 1; i <= T; i++){ yela(); } }

Compilation message (stderr)

rack.cpp: In function 'void setIO()':
rack.cpp:29:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |  freopen("in.txt", "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
rack.cpp:30:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |  freopen("out.txt", "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...