結果
| 問題 | 
                            No.321 (P,Q)-サンタと街の子供たち
                             | 
                    
| コンテスト | |
| ユーザー | 
                             syoken_desuka
                         | 
                    
| 提出日時 | 2015-12-17 21:54:50 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 2,297 bytes | 
| コンパイル時間 | 1,324 ms | 
| コンパイル使用メモリ | 158,068 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-09-16 07:38:51 | 
| 合計ジャッジ時間 | 6,449 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 10 WA * 3 RE * 28 | 
コンパイルメッセージ
main.cpp:26: warning: "DEBUG1" redefined
   26 | #define DEBUG1 {}
      | 
main.cpp:21: note: this is the location of the previous definition
   21 | #define DEBUG1(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
      | 
main.cpp:27: warning: "DEBUG2" redefined
   27 | #define DEBUG2 {}
      | 
main.cpp:22: note: this is the location of the previous definition
   22 | #define DEBUG2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; DEBUG1(var1); }
      | 
main.cpp:28: warning: "DEBUG3" redefined
   28 | #define DEBUG3 {}
      | 
main.cpp:23: note: this is the location of the previous definition
   23 | #define DEBUG3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; DEBUG2(var1, var2); }
      | 
main.cpp:29: warning: "DEBUG4" redefined
   29 | #define DEBUG4 {}
      | 
main.cpp:24: note: this is the location of the previous definition
   24 | #define DEBUG4(var0, var1, var2, var3) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; DEBUG3(var1, var2, var3); }
      | 
main.cpp: In function ‘ll gcd(ll, ll)’:
main.cpp:57:20: warning: control reaches end of non-void function [-Wreturn-type]
   57 |                 gcd(y,k);
      |                 ~~~^~~~~
            
            ソースコード
#include "bits/stdc++.h"
using namespace std;
//諸機能
#pragma region MACRO
#define ANSWER(x) cerr << "answer: "; cout << (x) << endl
#define D_ANSWER(x) cerr << "answer: "; cout << setprecision(10) << (double)(x) << endl
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define RREP(i,a,n) for(int i=(int)(a); i>= n; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define all(a) begin((a)),end((a))
#define FILL(a,n) for(auto &hoge : (a)) hoge = (n)
#define mp make_pair
#define EXIST(container, n) ((container).find((n)) != (container).end())
#define substr(s,i,l) string((s), (i), (l))
#define NPI_TO_RAD(x) (180.0*x/PI)
#define RAD_TO_NPI(x) (PI/180.0*x)
#pragma endregion
//デバッグなどの支援
#pragma region CODING_SUPPORT
#define DEBUG1(var0) { std::cerr << ( #var0 ) << "=" << ( var0 ) << endl; }
#define DEBUG2(var0, var1) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; DEBUG1(var1); }
#define DEBUG3(var0, var1, var2) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; DEBUG2(var1, var2); }
#define DEBUG4(var0, var1, var2, var3) { std::cerr << ( #var0 ) << "=" << ( var0 ) << ", "; DEBUG3(var1, var2, var3); }
#ifndef _DEBUG //デバッグでないなら、計算時間短縮のためにエラー出力を無効化
#define DEBUG1 {}
#define DEBUG2 {}
#define DEBUG3 {}
#define DEBUG4 {}
#endif 
#pragma endregion 
//typedef(書き換える、書き足す可能性ある)
#pragma region TYPE_DEF
typedef long long ll; 
typedef pair<int,int> pii;
typedef pair<string,string> pss;
typedef pair<int,string>pis;
typedef pair<string,int>psi;
typedef vector<string> vs;
typedef vector<int> vi;
#pragma endregion
//諸々の定数(書き換える可能性ある)
#pragma region CONST_VAL
#define PI (2*acos(0.0))
#define EPS (1e-9)
#define MOD (int)(1e9 + 7)
#pragma endregion
ll gcd(ll x, ll y) 
{
	ll k = x % y;
	if (k == 0)
	{
		return y;
	}
	else
		gcd(y,k);
}
int main()
{
	ll x = 4;
	ll y = 12;
	cin >> x >> y;
	ll a = x + y;
	ll b = abs(x - y);
	if (x == 0 && y == 0)
	{
		ANSWER(0);
		return 0;
	}
	int n; cin >> n;
	ll k = gcd(a,b);
	ll p; ll q;
	int count = 0;
	rep(i, n)
	{
		cin >> p >> q;
		ll x0 = abs(p + q);
		ll y0 = abs(p - q);
		if (x0 % k == 0 && y0 % k == 0)
		{
			count++;
			DEBUG2(x0,y0);
		}
	}
	ANSWER(count);
	return 0;
}
            
            
            
        
            
syoken_desuka