2018 ICPC shenyang G题

现场赛两个队友写了一句memset(arr, 0, sizeof(arr))// arr -> 6000 * 6000。于是我们自闭了3个小时。今天总算是在Gym上面把题补了,真的是巨感动。

#include<iostream>
#include<algorithm>
#include<set>
#include<utility>
#include<cstdio>
#include<vector>
#include<cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int maxn = 6e3;
const int maxm = 1e7;
vector<int> A[maxm + 5];
set<pii> s;
int t, op, k, w, n, m, cas;
ll res, arr[maxn + 5][maxn + 5], x, y;
void Init(){
    int up = sqrt(maxm);
    for(int i = 1; i <= up + 1; ++i){
        for(int j = i + 1; i * i + j * j <= maxm; ++j){
            int k = i * i + j * j;
            A[k].push_back(i);
        }
    }
}
void Clear(){
    res = 0;
    for(auto iter = s.begin(); iter != s.end(); ++iter){
        x = iter->first, y = iter->second;
        arr[x][y] = 0;
    }
    s.clear();
}
void Modify(){
    x = (x + res) % maxn + 1;
    y = (y + res) % maxn + 1;
}
void Increase(){
    int k1 = sqrt(k), k2 = sqrt(k / 2);
    ll u = x, v = y;
    if(k == 0){
        arr[u][v] +
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值