cf975d Ghosts
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<int,int> pir;
int n, a, b, uu, vv, ww;
map<ll,int> mp1;
map<pir,int> mp2;
int main(){
cin>>n>>a>>b;
ll ans=0;
for(int i=1; i<=n; i++){
scanf("%d %d %d", &uu, &vv, &ww);
ll tmp1 = (ll)a * vv - ww;
pir tmp2=make_pair(vv, ww);
ans += mp1[tmp1] - mp2[tmp2];
mp1[tmp1]++;
mp2[tmp2]++;
}
cout<<ans*2<<endl;
return 0;
}
cf975d Ghosts的更多相关文章
- 贪心+模拟 Codeforces Round #288 (Div. 2) C. Anya and Ghosts
题目传送门 /* 贪心 + 模拟:首先,如果蜡烛的燃烧时间小于最少需要点燃的蜡烛数一定是-1(蜡烛是1秒点一支), num[g[i]]记录每个鬼访问时已点燃的蜡烛数,若不够,tmp为还需要的蜡烛数, ...
- CodeForces 508C Anya and Ghosts
Anya and Ghosts Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u S ...
- Codeforces Round #288 (Div. 2) C. Anya and Ghosts 模拟
C. Anya and Ghosts time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- CF Anya and Ghosts (贪心)
Anya and Ghosts time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...
- [Swift]LeetCode789. 逃脱阻碍者 | Escape The Ghosts
You are playing a simplified Pacman game. You start at the point (0, 0), and your destination is (ta ...
- [LeetCode] Escape The Ghosts 逃离鬼魂
You are playing a simplified Pacman game. You start at the point (0, 0), and your destination is (ta ...
- LeetCode 789. Escape The Ghosts
题目链接:https://leetcode.com/problems/escape-the-ghosts/description/ You are playing a simplified Pacma ...
- Codeforces Round #288 (Div. 2) C. Anya and Ghosts 模拟 贪心
C. Anya and Ghosts time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- 73th LeetCode Weekly Contest Escape The Ghosts
You are playing a simplified Pacman game. You start at the point (0, 0), and your destination is(tar ...
随机推荐
- 【c++】用c++编写的求任意区间的素数的小程序
#include using namespace std; int main() { cout<<"*************************************** ...
- Eucalyptus管理页面密码设置
桉树环境什么的都已经是配置好了的,但是过了一段时间不用,也不知道密码是什么了,看着下面的页面也不知道如何进去,这里我们通过命令行的方式重置用户名和密码信息. 登陆clc所在机器,输入下命令: euar ...
- JavaScript_对象
1. 直接创建实例: //简单对象 var person1 = new Object(); person1.name = "Mike"; person1.age = 29; pe ...
- 使用CreateProcess函数运行其他程序
为了便于控制通过脚本运行的程序,可以使用win32process模块中的CreateProcess()函数创建一个运行相应程序的进程.其函数原型如下.CreateProcess(appName, co ...
- php使用GD库实现图片水印和缩略图——给图片添加文字水印
今天呢,就来学习一下在php中使用PD库来实现对图片水印的文字水印方法,不需要PS哦! 首先,准备素材 (1)准备一张图片 (2)准备一张水印(最好是透明的,即背景是白色底) (3)准备一中字体(在电 ...
- 在github中的READEME中添加图片或者动图
在github中reademe中添加动图或者图片 将你需要展示的图片放在这个项目中的某个文件夹中,然后再reademe中这样引入 与for...in的用法举例
1.forEach() 将给定的数字转换成罗马数字. 所有返回的 罗马数字 都应该是大写形式. function convert(num) { var str = ""; var ...
- 第十四篇、OC_新闻查看器
PageTitleView: #import <UIKit/UIKit.h> @class GFBPageTitleView; @protocol GFBPageTitleViewDele ...