Submission #714117

# Submission time Handle Problem Language Result Execution time Memory
714117 2023-03-24T01:27:18 Z DepressedMG Uzastopni (COCI17_uzastopni) C++17
56 / 80
40 ms 65536 KB
#include<bits/stdc++.h>
#define ull unsigned long long
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ull n,m,a,b,i,j;
	cin>>n;
	vector<ull> v(n/2+3);
	v[0]=0;
	for(i=1;i<v.size();i++){
		v[i]=v[i-1]+i;
	}
	j=v.size()-2;
	for(i=v.size();i>0 && j>0;){
		if(v[i]-v[j]<n){
			j--;
		}
		else{
			if(v[i]-v[j]>n){
				i--;
			}
			else{
				cout<<j+1<<" "<<i<<endl;
				j--;i--;
			}
		}
	}
	if(v[i]-v[j]<n){
			j--;
		}
		else{
			if(v[i]-v[j]>n){
				i--;
			}
			else{
				cout<<j+1<<" "<<i<<endl;
				j--;i--;
			}
		}
}

Compilation message

uzastopni.cpp: In function 'int main()':
uzastopni.cpp:7:8: warning: unused variable 'm' [-Wunused-variable]
    7 |  ull n,m,a,b,i,j;
      |        ^
uzastopni.cpp:7:10: warning: unused variable 'a' [-Wunused-variable]
    7 |  ull n,m,a,b,i,j;
      |          ^
uzastopni.cpp:7:12: warning: unused variable 'b' [-Wunused-variable]
    7 |  ull n,m,a,b,i,j;
      |            ^
# 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 596 KB Output is correct
5 Correct 1 ms 1108 KB Output is correct
6 Correct 8 ms 8136 KB Output is correct
7 Correct 40 ms 39368 KB Output is correct
8 Runtime error 30 ms 65536 KB Execution killed with signal 9
9 Runtime error 30 ms 65536 KB Execution killed with signal 9
10 Runtime error 2 ms 596 KB Execution killed with signal 6