Submission #551377

# Submission time Handle Problem Language Result Execution time Memory
551377 2022-04-20T14:25:27 Z Olympia Odd-even (IZhO11_oddeven) C++17
0 / 100
2000 ms 324 KB
#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
#include <cassert>
#include <map>
#include <complex>
#include <cmath>
#include <set>
#include <queue>
using namespace std;

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int64_t n; cin >> n;
    int64_t sq = sqrt(n * 2) - 2;
    while (sq * (sq + 1)/2 < n) {
        sq++;
    }
    //sq++;
    cout << sq * sq + 2 *(n - (sq + 1) * sq/2) << '\n';
}

Compilation message

oddeven.cpp:14: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
   14 | #pragma GCC optimization ("O3")
      | 
oddeven.cpp:15: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
   15 | #pragma GCC optimization ("unroll-loops")
      |
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Execution timed out 2069 ms 212 KB Time limit exceeded
14 Halted 0 ms 0 KB -