Submission #486053


Source Code Expand

Copy
#include <cstdio>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cstdlib>
#include <iostream>

using namespace std;

#define MOD @
#define ADD(X,Y) ((X) = ((X) + (Y)) % MOD)
typedef long long i64; typedef vector<int> ivec; typedef vector<string> svec;

int L, S;

int gcd(int a, int b)
{
	return b == 0 ? a : gcd(b, a % b);
}

bool chk(int a, int b, int c)
{
	return a + b + c <= L && a <= b && b <= c && a + b > c && gcd(gcd(a, b), c) == 1;
}

void small()
{
	int ret = 0;
	for (int a = 1; a <= L / 3; ++a) {
		int a2s2 = a * a + S * S;

		for (int df = 1; df * df < a2s2; ++df) {
			if (a2s2 % df == 0) {
				int sm = a2s2 / df;

				if (sm % 2 != df % 2) continue;

				if (chk(a, (sm - df) / 2, (sm + df) / 2)) {
					++ret;
				}
			}
		}
	}
	printf("%d\n", ret);
}

int main()
{
	scanf("%d%d", &L, &S);

	if (L <= 10000) {
		small();
	}

	return 0;
}

Submission Info

Submission Time
Task D - ほぼピタゴラスの三角形
User semiexp
Language C++11 (GCC 4.9.2)
Score 60
Code Size 1039 Byte
Status WA
Exec Time 70 ms
Memory 928 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:55:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &L, &S);
                       ^

Judge Result

Set Name small All
Score / Max Score 60 / 60 0 / 140
Status
AC × 135
AC × 135
WA × 41
Set Name Test Cases
small 00_example_1.txt, 00_example_2.txt, 03_small_00.txt, 03_small_01.txt, 03_small_02.txt, 03_small_03.txt, 03_small_04.txt, 03_small_05.txt, 03_small_06.txt, 03_small_07.txt, 03_small_08.txt, 03_small_09.txt, 03_small_10.txt, 03_small_11.txt, 03_small_12.txt, 03_small_13.txt, 03_small_14.txt, 03_small_15.txt, 03_small_16.txt, 03_small_17.txt, 03_small_18.txt, 03_small_19.txt, 03_small_20.txt, 03_small_21.txt, 03_small_22.txt, 03_small_23.txt, 03_small_24.txt, 03_small_25.txt, 03_small_26.txt, 03_small_27.txt, 03_small_28.txt, 03_small_29.txt, 03_small_30.txt, 03_small_31.txt, 03_small_32.txt, 03_small_33.txt, 03_small_34.txt, 03_small_35.txt, 03_small_36.txt, 03_small_37.txt, 03_small_38.txt, 03_small_39.txt, 03_small_40.txt, 03_small_41.txt, 03_small_42.txt, 03_small_43.txt, 03_small_44.txt, 03_small_45.txt, 03_small_46.txt, 03_small_47.txt, 03_small_48.txt, 03_small_49.txt, 03_small_50.txt, 03_small_51.txt, 03_small_52.txt, 03_small_53.txt, 03_small_54.txt, 03_small_55.txt, 03_small_56.txt, 03_small_57.txt, 03_small_58.txt, 03_small_59.txt, 03_small_60.txt, 03_small_61.txt, 03_small_62.txt, 03_small_63.txt, 03_small_64.txt, 03_small_65.txt, 03_small_66.txt, 03_small_67.txt, 03_small_68.txt, 03_small_69.txt, 03_small_70.txt, 03_small_71.txt, 03_small_72.txt, 03_small_73.txt, 03_small_74.txt, 03_small_75.txt, 03_small_76.txt, 03_small_77.txt, 03_small_78.txt, 03_small_79.txt, 03_small_80.txt, 03_small_81.txt, 03_small_82.txt, 03_small_83.txt, 03_small_84.txt, 03_small_85.txt, 03_small_86.txt, 03_small_87.txt, 03_small_88.txt, 03_small_89.txt, 03_small_90.txt, 03_small_91.txt, 03_small_92.txt, 03_small_93.txt, 03_small_94.txt, 03_small_95.txt, 03_small_96.txt, 03_small_97.txt, 03_small_98.txt, 03_small_99.txt, 05_small_random_1.txt, 05_small_random_10.txt, 05_small_random_11.txt, 05_small_random_12.txt, 05_small_random_13.txt, 05_small_random_14.txt, 05_small_random_15.txt, 05_small_random_16.txt, 05_small_random_17.txt, 05_small_random_18.txt, 05_small_random_19.txt, 05_small_random_2.txt, 05_small_random_20.txt, 05_small_random_21.txt, 05_small_random_22.txt, 05_small_random_23.txt, 05_small_random_24.txt, 05_small_random_25.txt, 05_small_random_26.txt, 05_small_random_27.txt, 05_small_random_28.txt, 05_small_random_29.txt, 05_small_random_3.txt, 05_small_random_30.txt, 05_small_random_4.txt, 05_small_random_5.txt, 05_small_random_6.txt, 05_small_random_7.txt, 05_small_random_8.txt, 05_small_random_9.txt, 08_manual_0.txt, 08_manual_2.txt, 08_manual_3.txt
All 00_example_1.txt, 00_example_2.txt, 03_small_00.txt, 03_small_01.txt, 03_small_02.txt, 03_small_03.txt, 03_small_04.txt, 03_small_05.txt, 03_small_06.txt, 03_small_07.txt, 03_small_08.txt, 03_small_09.txt, 03_small_10.txt, 03_small_11.txt, 03_small_12.txt, 03_small_13.txt, 03_small_14.txt, 03_small_15.txt, 03_small_16.txt, 03_small_17.txt, 03_small_18.txt, 03_small_19.txt, 03_small_20.txt, 03_small_21.txt, 03_small_22.txt, 03_small_23.txt, 03_small_24.txt, 03_small_25.txt, 03_small_26.txt, 03_small_27.txt, 03_small_28.txt, 03_small_29.txt, 03_small_30.txt, 03_small_31.txt, 03_small_32.txt, 03_small_33.txt, 03_small_34.txt, 03_small_35.txt, 03_small_36.txt, 03_small_37.txt, 03_small_38.txt, 03_small_39.txt, 03_small_40.txt, 03_small_41.txt, 03_small_42.txt, 03_small_43.txt, 03_small_44.txt, 03_small_45.txt, 03_small_46.txt, 03_small_47.txt, 03_small_48.txt, 03_small_49.txt, 03_small_50.txt, 03_small_51.txt, 03_small_52.txt, 03_small_53.txt, 03_small_54.txt, 03_small_55.txt, 03_small_56.txt, 03_small_57.txt, 03_small_58.txt, 03_small_59.txt, 03_small_60.txt, 03_small_61.txt, 03_small_62.txt, 03_small_63.txt, 03_small_64.txt, 03_small_65.txt, 03_small_66.txt, 03_small_67.txt, 03_small_68.txt, 03_small_69.txt, 03_small_70.txt, 03_small_71.txt, 03_small_72.txt, 03_small_73.txt, 03_small_74.txt, 03_small_75.txt, 03_small_76.txt, 03_small_77.txt, 03_small_78.txt, 03_small_79.txt, 03_small_80.txt, 03_small_81.txt, 03_small_82.txt, 03_small_83.txt, 03_small_84.txt, 03_small_85.txt, 03_small_86.txt, 03_small_87.txt, 03_small_88.txt, 03_small_89.txt, 03_small_90.txt, 03_small_91.txt, 03_small_92.txt, 03_small_93.txt, 03_small_94.txt, 03_small_95.txt, 03_small_96.txt, 03_small_97.txt, 03_small_98.txt, 03_small_99.txt, 05_small_random_1.txt, 05_small_random_10.txt, 05_small_random_11.txt, 05_small_random_12.txt, 05_small_random_13.txt, 05_small_random_14.txt, 05_small_random_15.txt, 05_small_random_16.txt, 05_small_random_17.txt, 05_small_random_18.txt, 05_small_random_19.txt, 05_small_random_2.txt, 05_small_random_20.txt, 05_small_random_21.txt, 05_small_random_22.txt, 05_small_random_23.txt, 05_small_random_24.txt, 05_small_random_25.txt, 05_small_random_26.txt, 05_small_random_27.txt, 05_small_random_28.txt, 05_small_random_29.txt, 05_small_random_3.txt, 05_small_random_30.txt, 05_small_random_4.txt, 05_small_random_5.txt, 05_small_random_6.txt, 05_small_random_7.txt, 05_small_random_8.txt, 05_small_random_9.txt, 08_manual_0.txt, 08_manual_2.txt, 08_manual_3.txt, 10_max_01.txt, 10_max_02.txt, 10_max_03.txt, 10_max_04.txt, 10_max_05.txt, 10_max_06.txt, 10_max_07.txt, 10_max_08.txt, 10_max_09.txt, 10_max_10.txt, 10_max_41.txt, 10_max_42.txt, 10_max_43.txt, 10_max_44.txt, 10_max_45.txt, 10_max_46.txt, 10_max_47.txt, 10_max_48.txt, 10_max_49.txt, 10_max_50.txt, 11_large_00.txt, 11_large_01.txt, 11_large_02.txt, 11_large_03.txt, 11_large_04.txt, 11_large_05.txt, 11_large_06.txt, 11_large_07.txt, 11_large_08.txt, 11_large_09.txt, 20_manual_1.txt, 20_manual_10.txt, 20_manual_11.txt, 20_manual_12.txt, 20_manual_13.txt, 20_manual_4.txt, 20_manual_5.txt, 20_manual_6.txt, 20_manual_7.txt, 20_manual_8.txt, 20_manual_9.txt
Case Name Status Exec Time Memory
00_example_1.txt AC 25 ms 796 KB
00_example_2.txt AC 24 ms 800 KB
03_small_00.txt AC 25 ms 800 KB
03_small_01.txt AC 27 ms 740 KB
03_small_02.txt AC 26 ms 796 KB
03_small_03.txt AC 30 ms 764 KB
03_small_04.txt AC 26 ms 800 KB
03_small_05.txt AC 25 ms 916 KB
03_small_06.txt AC 26 ms 916 KB
03_small_07.txt AC 24 ms 672 KB
03_small_08.txt AC 26 ms 788 KB
03_small_09.txt AC 25 ms 788 KB
03_small_10.txt AC 25 ms 792 KB
03_small_11.txt AC 24 ms 804 KB
03_small_12.txt AC 25 ms 920 KB
03_small_13.txt AC 26 ms 796 KB
03_small_14.txt AC 26 ms 916 KB
03_small_15.txt AC 27 ms 920 KB
03_small_16.txt AC 26 ms 916 KB
03_small_17.txt AC 28 ms 916 KB
03_small_18.txt AC 26 ms 756 KB
03_small_19.txt AC 26 ms 916 KB
03_small_20.txt AC 27 ms 920 KB
03_small_21.txt AC 26 ms 796 KB
03_small_22.txt AC 27 ms 924 KB
03_small_23.txt AC 25 ms 696 KB
03_small_24.txt AC 27 ms 804 KB
03_small_25.txt AC 26 ms 908 KB
03_small_26.txt AC 27 ms 800 KB
03_small_27.txt AC 30 ms 792 KB
03_small_28.txt AC 26 ms 796 KB
03_small_29.txt AC 26 ms 916 KB
03_small_30.txt AC 26 ms 920 KB
03_small_31.txt AC 26 ms 796 KB
03_small_32.txt AC 25 ms 792 KB
03_small_33.txt AC 26 ms 804 KB
03_small_34.txt AC 26 ms 792 KB
03_small_35.txt AC 27 ms 792 KB
03_small_36.txt AC 27 ms 920 KB
03_small_37.txt AC 27 ms 924 KB
03_small_38.txt AC 27 ms 924 KB
03_small_39.txt AC 27 ms 696 KB
03_small_40.txt AC 27 ms 920 KB
03_small_41.txt AC 27 ms 796 KB
03_small_42.txt AC 27 ms 924 KB
03_small_43.txt AC 26 ms 804 KB
03_small_44.txt AC 28 ms 796 KB
03_small_45.txt AC 27 ms 912 KB
03_small_46.txt AC 27 ms 928 KB
03_small_47.txt AC 30 ms 928 KB
03_small_48.txt AC 26 ms 804 KB
03_small_49.txt AC 27 ms 928 KB
03_small_50.txt AC 27 ms 928 KB
03_small_51.txt AC 26 ms 672 KB
03_small_52.txt AC 25 ms 800 KB
03_small_53.txt AC 27 ms 912 KB
03_small_54.txt AC 26 ms 916 KB
03_small_55.txt AC 27 ms 916 KB
03_small_56.txt AC 26 ms 920 KB
03_small_57.txt AC 28 ms 796 KB
03_small_58.txt AC 26 ms 928 KB
03_small_59.txt AC 27 ms 920 KB
03_small_60.txt AC 26 ms 920 KB
03_small_61.txt AC 26 ms 916 KB
03_small_62.txt AC 27 ms 672 KB
03_small_63.txt AC 28 ms 916 KB
03_small_64.txt AC 27 ms 796 KB
03_small_65.txt AC 27 ms 800 KB
03_small_66.txt AC 24 ms 924 KB
03_small_67.txt AC 24 ms 796 KB
03_small_68.txt AC 26 ms 928 KB
03_small_69.txt AC 33 ms 804 KB
03_small_70.txt AC 27 ms 924 KB
03_small_71.txt AC 34 ms 920 KB
03_small_72.txt AC 34 ms 736 KB
03_small_73.txt AC 32 ms 920 KB
03_small_74.txt AC 28 ms 916 KB
03_small_75.txt AC 33 ms 756 KB
03_small_76.txt AC 31 ms 796 KB
03_small_77.txt AC 27 ms 920 KB
03_small_78.txt AC 26 ms 796 KB
03_small_79.txt AC 27 ms 920 KB
03_small_80.txt AC 28 ms 756 KB
03_small_81.txt AC 25 ms 924 KB
03_small_82.txt AC 27 ms 924 KB
03_small_83.txt AC 26 ms 796 KB
03_small_84.txt AC 24 ms 720 KB
03_small_85.txt AC 28 ms 760 KB
03_small_86.txt AC 26 ms 796 KB
03_small_87.txt AC 23 ms 800 KB
03_small_88.txt AC 23 ms 800 KB
03_small_89.txt AC 26 ms 924 KB
03_small_90.txt AC 26 ms 796 KB
03_small_91.txt AC 24 ms 748 KB
03_small_92.txt AC 25 ms 916 KB
03_small_93.txt AC 25 ms 676 KB
03_small_94.txt AC 26 ms 800 KB
03_small_95.txt AC 29 ms 912 KB
03_small_96.txt AC 26 ms 796 KB
03_small_97.txt AC 26 ms 800 KB
03_small_98.txt AC 27 ms 676 KB
03_small_99.txt AC 27 ms 916 KB
05_small_random_1.txt AC 26 ms 804 KB
05_small_random_10.txt AC 27 ms 672 KB
05_small_random_11.txt AC 28 ms 672 KB
05_small_random_12.txt AC 70 ms 800 KB
05_small_random_13.txt AC 34 ms 800 KB
05_small_random_14.txt AC 49 ms 916 KB
05_small_random_15.txt AC 55 ms 736 KB
05_small_random_16.txt AC 60 ms 920 KB
05_small_random_17.txt AC 64 ms 800 KB
05_small_random_18.txt AC 47 ms 792 KB
05_small_random_19.txt AC 45 ms 792 KB
05_small_random_2.txt AC 29 ms 916 KB
05_small_random_20.txt AC 27 ms 796 KB
05_small_random_21.txt AC 67 ms 744 KB
05_small_random_22.txt AC 59 ms 800 KB
05_small_random_23.txt AC 35 ms 800 KB
05_small_random_24.txt AC 43 ms 680 KB
05_small_random_25.txt AC 48 ms 916 KB
05_small_random_26.txt AC 29 ms 920 KB
05_small_random_27.txt AC 26 ms 808 KB
05_small_random_28.txt AC 40 ms 920 KB
05_small_random_29.txt AC 57 ms 796 KB
05_small_random_3.txt AC 37 ms 916 KB
05_small_random_30.txt AC 35 ms 796 KB
05_small_random_4.txt AC 66 ms 756 KB
05_small_random_5.txt AC 41 ms 796 KB
05_small_random_6.txt AC 32 ms 924 KB
05_small_random_7.txt AC 31 ms 916 KB
05_small_random_8.txt AC 45 ms 920 KB
05_small_random_9.txt AC 42 ms 800 KB
08_manual_0.txt AC 70 ms 796 KB
08_manual_2.txt AC 25 ms 924 KB
08_manual_3.txt AC 68 ms 800 KB
10_max_01.txt WA 24 ms 744 KB
10_max_02.txt WA 24 ms 788 KB
10_max_03.txt WA 25 ms 800 KB
10_max_04.txt WA 27 ms 916 KB
10_max_05.txt WA 26 ms 668 KB
10_max_06.txt WA 26 ms 788 KB
10_max_07.txt WA 26 ms 796 KB
10_max_08.txt WA 26 ms 792 KB
10_max_09.txt WA 25 ms 788 KB
10_max_10.txt WA 26 ms 792 KB
10_max_41.txt WA 26 ms 796 KB
10_max_42.txt WA 26 ms 920 KB
10_max_43.txt WA 25 ms 788 KB
10_max_44.txt WA 25 ms 920 KB
10_max_45.txt WA 26 ms 916 KB
10_max_46.txt WA 26 ms 744 KB
10_max_47.txt WA 26 ms 920 KB
10_max_48.txt WA 26 ms 796 KB
10_max_49.txt WA 26 ms 788 KB
10_max_50.txt WA 27 ms 920 KB
11_large_00.txt WA 26 ms 796 KB
11_large_01.txt WA 25 ms 788 KB
11_large_02.txt WA 26 ms 916 KB
11_large_03.txt WA 29 ms 736 KB
11_large_04.txt WA 24 ms 800 KB
11_large_05.txt WA 24 ms 700 KB
11_large_06.txt WA 24 ms 800 KB
11_large_07.txt WA 27 ms 804 KB
11_large_08.txt WA 25 ms 800 KB
11_large_09.txt WA 24 ms 744 KB
20_manual_1.txt WA 25 ms 800 KB
20_manual_10.txt WA 26 ms 796 KB
20_manual_11.txt WA 25 ms 804 KB
20_manual_12.txt WA 26 ms 748 KB
20_manual_13.txt WA 25 ms 796 KB
20_manual_4.txt WA 25 ms 800 KB
20_manual_5.txt WA 26 ms 668 KB
20_manual_6.txt WA 26 ms 668 KB
20_manual_7.txt WA 25 ms 920 KB
20_manual_8.txt WA 26 ms 796 KB
20_manual_9.txt WA 25 ms 796 KB