Submission #1091865

# Submission time Handle Problem Language Result Execution time Memory
1091865 2024-09-22T11:41:16 Z KluydQ Odd-even (IZhO11_oddeven) C++17
0 / 100
2000 ms 348 KB
#include <bits/stdc++.h>

#define FOR( i, x, n, d ) for( int i = x; i <= n; i += d )
#define int long long

using namespace std;
const int N = 1e5;

signed main()
{
	ios_base::sync_with_stdio(0), cin.tie(0);
	
	int n; cin >> n;
	int ans = 0;
	
	for( int i = 0; n > 0; i ++ )
	{
		if( i >= n ) ans += ( n - 1 ) * 2 + 1, n = 0;
		else n -= i + 1, ans += i * 2 + 1;
	}
	cout << ans;
}
// n i ans
// 3 0 1
// 1 1 3
// 
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 2 ms 348 KB Output is correct
8 Correct 9 ms 348 KB Output is correct
9 Correct 21 ms 348 KB Output is correct
10 Correct 71 ms 348 KB Output is correct
11 Correct 280 ms 348 KB Output is correct
12 Correct 593 ms 348 KB Output is correct
13 Execution timed out 2064 ms 344 KB Time limit exceeded
14 Halted 0 ms 0 KB -