Submission #1292325

#TimeUsernameProblemLanguageResultExecution timeMemory
1292325binminh01Party (INOI20_party)C++20
30 / 100
2 ms736 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define double long double #define sz(a) (int)a.size() #define all(a) (a).begin(), (a).end() #define rall(a) (a).rbegin(), (a).rend() #define pb push_back #define eb emplace_back #define open(s) freopen(s, "r", stdin) #define write(s) freopen(s, "w", stdout) using pii = pair<int, int>; using pll = pair<ll, ll>; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<double> vdo; typedef vector<vdo> vvdo; typedef vector<string> vs; typedef vector<pii> vpair; typedef vector<vpair> vvpair; typedef vector<bool> vb; typedef vector<vb> vvb; typedef vector<char> vc; typedef vector<vc> vvc; typedef priority_queue<int> pq; typedef priority_queue<int, vi, greater<int>> pqg; typedef priority_queue<ll> pqll; typedef priority_queue<ll, vll, greater<ll>> pqgll; #define For(i, a, b) for (auto i = (a); i < (b); ++i) #define FOR(i, a, b) for (auto i = (a); i <= (b); ++i) #define Fore(i, a, b) for (auto i = (a); i >= (b); --i) #define trav(i, a) for (auto &i: a) constexpr int mod = (int)1e9 + 7; constexpr int ans1[] = {0,0,666666672,571428577,733333341,548387104,285714292,401574811,54901967,305283766,687194538,930630205,637851051,269564167,48220727,68575102,889417886,481716032,687056319,954051904,121547830,239217412,999114059,498264988,847103550,758761690,638522568,268899203,802375319,911887665,665647523,347470132,249948686,415505300,293580916,631099079,133397470,179641631,908225308,735415978,370496430,925361906,675702668,992844490,586790472,486337579,425150383,664592138,914789996,772456654,799879782,899195971,337434977,870849620,429060808,261158658,304825485,495778058,172841730,550803456,621379872,825247430,195174391,149707164,550237255,434017081,508502652,962252350,486033940,216956820,610127529,961466989,549906267,367921647,594964096,276698183,809717020,81528533,744656687,495311643,866954358,131441158,314370724,170132716,983933855,527513392,632834937,675660064,315749494,839731414,530949465,942829728,529725350,821306848,967466098,781228030,679039065,653977477,841867588,406101445,671916196,154660144,128303839,221224696,920685660,777084320,395430897,335136412,722644706,248891204,504457951,775248161,349796576,74857969,729964279,978279169,389616934,164479112,89793646,423460149,696236474,176676045,186090600,893614131,639796232,446656698,526261967,295038330,825220882,697866216,976082617,768952803,186815674,165986386,93773490,612773827,898380343,97082244,510520259,874516626,157110604,717223381,49756112,567353074,424486813,131235898,255307387,787070716,98378846,995605722,755309723,411918937,600100782,17321362,303222205,499750831,997171493,175600679,674410914,278528097,212497643,589944900,543573141,930376920,689938960,112006801,328572912,195606533,586277662,109153634,745980494,286667447,755139031,497350598,608913514,639723549,304170631,759757033,773061231,904529395,143673214,767943674,612568341,523953553,447605849,799432615,627312407,187297556,821063613,794958645,872059132,108593592,610831908,75896678,83678274,526936897,632317225,178730200,941861036,866083134,463189473}; constexpr int ans2[] = {0,0,571428577,401574811,68575102,347470132,149707164,295038330,246944817,168459846,848759170,753916649,874259235,436845857,455803345,732110426,912252260,380931639,725126576,755085026,497747095,601032270,132018618,195747679,326166778,90750519,950969612,561147124,716973945,398359507,245333203,645374876,58517764,882537570,387870120,174478760,770163916,657328870,392199940,752435265,596273060,880391751,607922078,465118232,314990412,429160328,670114601,83625202,713881005,807523234,400261067,826581252,770146593,608067344,280418783,20107917,573628670,767615667,381834390,980680016}; void solve() { ll n; cin >> n; if (n <= 200) { cout << ans1[n]; return; } int k = __lg(n + 1); if (n == (1ll << k) - 1) { cout << ans2[k]; return; } } int main() { if (fopen("party.inp", "r")) freopen("party.inp", "r", stdin), freopen("party.out", "w", stdout); ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int tt; cin >> tt; while (tt--) solve(), cout << '\n'; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:52:41: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |     if (fopen("party.inp", "r")) freopen("party.inp", "r", stdin), freopen("party.out", "w", stdout);
      |                                  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:52:75: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |     if (fopen("party.inp", "r")) freopen("party.inp", "r", stdin), freopen("party.out", "w", stdout);
      |                                                                    ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...