Submission #1296538

#TimeUsernameProblemLanguageResultExecution timeMemory
1296538Ekber_EkberRack (eJOI19_rack)C++20
100 / 100
2 ms576 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/assoc_container.hpp> #define GOOD_LUCK ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define int long long #define itn int #define endl "\n" #define ff first #define ss second #define pb push_back #define ppb pop_back #define ins insert #define lb lower_bound #define ub upper_bound #define bs binary_search #define count1 __builtin_popcount #define all(v) v.begin(), v.end() #define unset unordered_set #define unmap unordered_map #define pqueue priority_queue #define ordered_set_less tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> #define ordered_set_greater tree<int, null_type, greater<int>, rb_tree_tag, tree_order_statistics_node_update> using namespace std; using namespace __gnu_pbds; constexpr int MAX = 1e+5 + 3, INF = 2e+9, MOD = 1e+9 + 7, K = 18; int temp, temp1, temp2, temp3; int exp(int a, int b, int c=MOD) { if (b == 0) return 1; if (b % 2) return (a * exp(a, b-1, c) % c) % c; return exp((a * a) % c, b/2, c) %c; } void _() { int n, k; cin >> n >> k; int res=1; while (n >= 0) { n--; if (k % 2 == 0) { res += exp(2, n); res %= MOD; } k = (k + 1) / 2; } cout << res; } signed main() { GOOD_LUCK // freopen("input.txt", "r", stdin); // freopen("output.txt", "w", stdout); freopen("log.txt", "w", stderr); srand(time(0)); int tests=1; // cin >> tests; for (int i=1; i <= tests; i++) { // cout << "Case #" << i << ": "; _(); // cout << endl; } // int n; // while (cin >> n) { // _(n); // cout << endl; // } return 0; } // Problem X // by Ekber_Ekber /* */

Compilation message (stderr)

rack.cpp: In function 'int main()':
rack.cpp:57:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   57 |         freopen("log.txt", "w", stderr);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...