g - best acmer solves the hardest problem
gym - 101955g
由於k都是整數,而在圓上的整數點很少,所以想到,tx^2 + ty^2 = k^2 ,
處理出來 k 對應的所有的 tx 和 ty,那麼對於(x,y),k,圓上所有的點為 (txdirx + x, tydiry + y) , dir表示方向,每一對 tx 和 ty 對應四個點; 由於tx或者 ty==0 或者 tx == ty 導致四個點有重複,所以需要去重(sort+unique或者set、map);答案用ll 存,
這道題細節還是比較多
ac**
#include
using
namespace std;
typedef
long
long ll;
const
int n=
1e7+5;
const
int inf=
0x3f3f3f3f
;const
int mod=
1e9+7;
#define ls (i<<1)
#define rs (i<<1|1)
#define fi first
#define se second
#define mk make_pair
#define mem(a,b) memset(a,b,sizeof(a))
ll read()
return x*t;
}ll c[
6005][
6005];
int xx=
;int yy=
;vectorint,
int>
> a[n]
,cls;
inline
void
init()
cls.
clear()
;}intmain()
int t=
read()
,test=0;
while
(t--
) ll lastans=0;
printf
("case #%d:\n"
,++test)
;while
(m--
)else
if(cmd==
2) c[x]
[y]=0;
else
if(cmd==3)
}for
(setint,
int>
>
::iterator it=s.
begin()
;it!=s.
end(
);it++)}
else
}for
(setint,
int>
>
::iterator it=s.
begin()
;it!=s.
end(
);it++
)printf
("%lld\n"
,ans)
; lastans=ans;}}
init()
;}return0;
}/*23 6
2999 3000 1
3001 3000 1
3000 2999 1
1 2999 3000 1
4 2999 2999 1
2 2995 2996
3 2995 2995 1 1
4 2995 2995 1
4 3000 3000 1
3 62999 3000 1
3001 3000 1
3000 2999 1
1 2999 3000 1
4 2999 2999 1
2 2995 2996
3 2995 2995 1 1
4 2995 2995 1
4 3000 3000 1
*/
2018 ICPC瀋陽站總結
day0 這次比賽是坐飛機去的,還是很興奮的,一路上覺得都很新鮮,東航還給吃的,飛機是真的舒服,還特別快。我們周五上午就到了,一開始去了乙個高階的如家酒店,一會才發現,自己定的不是這家,我說怎麼這麼好。然後中午吃了個旋轉火鍋,特別難吃,下午回到賓館,抓緊刷了兩道題,到了晚上,想著出去逛逛,然後去吃了...
2018 icpc 南京網路賽
題目 鏈結 a.an olympian math problem 輸出n 1即可 女朋友猜的 includeusing namespace std define ll long long ll fac 103 int main for int i 1 i m i ll ans 0 for int i...
2018ICPC北京賽總結
00 05.23 冰冷而空曠啊,00 11.83 燈火離我遠去,00 18.95 誰知你何時會犧牲 00 33.17 永別了,親愛的故土!00 39.61 這離別真切得讓我不能相信。00 46.63 母親啊,故鄉啊,00 53.45 永別了,偉大的祖國!01 04.11 讓我們起航吧,大海在召喚我們...