Submission #305656


Source Code Expand

#include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
long long ABS(long long a){return max(a,-a);}
int main(){
	int a;scanf("%d",&a);
	while(a--){
		long long b;scanf("%lld",&b);
		b--;
		long long t=(long long)sqrt((double)b/2);
		long long n=0;
		for(int i=-10;i<=10;i++){
			if(t+i<0)continue;
			n=t+i;
			if(1+(t+i)*(t+i+1)*2>b)break;
		}
		long long v=b-(1+(n-1)*(n)*2);
		long long x=-n+(v+1)/2;
		long long y=n-ABS(x);
		if(v%2)y=-y;
		printf("%lld %lld\n",x,y);
	}
}

Submission Info

Submission Time
Task B - n-th Points
User tozangezan
Language C++ (G++ 4.6.4)
Score 100
Code Size 521 Byte
Status AC
Exec Time 119 ms
Memory 804 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:7:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:9:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 1
AC × 11
Set Name Test Cases
Sample subtask0_sample_01.txt
All subtask0_sample_01.txt, subtask1_large_01.txt, subtask1_mini01.txt, subtask1_random01.txt, subtask1_random02.txt, subtask1_random03.txt, subtask1_random04.txt, subtask1_random05.txt, subtask1_random06.txt, subtask1_random07.txt, subtask1_random08.txt
Case Name Status Exec Time Memory
subtask0_sample_01.txt AC 21 ms 796 KB
subtask1_large_01.txt AC 106 ms 796 KB
subtask1_mini01.txt AC 77 ms 804 KB
subtask1_random01.txt AC 86 ms 788 KB
subtask1_random02.txt AC 84 ms 804 KB
subtask1_random03.txt AC 88 ms 700 KB
subtask1_random04.txt AC 117 ms 784 KB
subtask1_random05.txt AC 99 ms 688 KB
subtask1_random06.txt AC 115 ms 796 KB
subtask1_random07.txt AC 119 ms 792 KB
subtask1_random08.txt AC 119 ms 672 KB