Submission #90718

# Submission time Handle Problem Language Result Execution time Memory
90718 2018-12-24T01:02:09 Z Ahmad_Elsisy Uzastopni (COCI17_uzastopni) C++14
0 / 80
3 ms 804 KB
#include <bits/stdc++.h>
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define popcnt(x) __builtin_popcount(x)
#define inf 0x3f3f3f3f
#define watch(x) cout << (#x) << " is " << (x) << endl

using namespace std;
typedef long long  ll;

int dx[] = {0 , 0 , 1 , -1 , 1 , 1 , -1 , -1};
int dy[] = {1 ,-1 , 0 , 0 , -1 , 1 ,  1 , -1};

int main() {
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r" , stdin);
#endif
    ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0);
    ll N;
    cin >> N;

    vector<pair<ll , ll> > res;
    for(ll cur = 2 ; cur * (cur + 1) / 2 <= N ; ++cur){
        if((N * 2) % cur == 0){
            ll s = N * 2 / cur;
            ll y = (s + cur - 1) / 2;

            ll x = y - cur + 1;

            if((x + y) * cur / 2 == N)res.pb({x , y});
        }
    }

    for(auto e : res)
        cout << e.first << ' ' << e.second << '\n';
}

Compilation message

uzastopni.cpp: In function 'int main()':
uzastopni.cpp:16:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   freopen("input.txt", "r" , stdin);
   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Incorrect 3 ms 500 KB Output isn't correct
3 Incorrect 3 ms 584 KB Output isn't correct
4 Incorrect 3 ms 584 KB Output isn't correct
5 Incorrect 3 ms 584 KB Output isn't correct
6 Incorrect 3 ms 708 KB Output isn't correct
7 Incorrect 3 ms 804 KB Output isn't correct
8 Incorrect 3 ms 804 KB Output isn't correct
9 Incorrect 3 ms 804 KB Output isn't correct
10 Incorrect 3 ms 804 KB Output isn't correct