Submission #474655

#TimeUsernameProblemLanguageResultExecution timeMemory
474655LptN21Uzastopni (COCI17_uzastopni)C++14
80 / 80
2 ms292 KiB
#include <bits/stdc++.h> using namespace std; #define fastIO ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL) #define PI acos(-1.0) #define FF first #define SS second #define eps 1e-9 // vector #define pb push_back #define sz(v) int((v).size()) #define all(v) (v).begin(), (v).end() #define lb lower_bound #define ub upper_bound // bit #define CNTBIT(x) __builtin_popcount(x) #define ODDBIT(x) __builtin_parity(x) #define MASK(i) (1ll<<(i)) #define BIT(x, i) (((x)>>(i))&1) #define SUBSET(big, small) (((big)&(small))==(small)) #define MINBIT(x) (x)&(-x) // typedef typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<ll, ll> ii; typedef pair<int, ii> i3; /* CODE BELOW */ const int N=1e5+7, M=30; const int MOD=1e9+7; const int oo=1e8+7; int n, m, k, t; signed main() { //freopen("tlt.inp", "r", stdin); //freopen("tlt.out", "w", stdout); //fastIO; ll n; scanf("%lld", &n); vector<ii> a; for(ll i=1;i*i<=2*n;i++) { ll x=(2*n-i*i-i); ll y=2*(i+1); if(x%y) continue; a.pb(ii(-x/y, x/y+i)); } sort(all(a)); for(ii tmp:a) printf("%lld %lld\n", -tmp.FF, tmp.SS); return 0; } /* stuff you should look for - int overflow, array bounds - special/edge cases (n=1?) - do smth instead of nothing and stay organized - WRITE STUFF DOWN - DONT JUST STICK ON ONE APPROACH */

Compilation message (stderr)

uzastopni.cpp: In function 'int main()':
uzastopni.cpp:40:16: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |     ll n; scanf("%lld", &n);
      |           ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...