zoukankan      html  css  js  c++  java
  • [JZOJ 100025] 棋盘

    题意:求剩余面积。
    首先吐槽题号:究竟\(JZOJ\)有多少未公开的题目...
    思路:
    简单的一批啊...
    不知道为啥上午不过下午就过了??
    难道是海螺姑娘光顾我??
    多说了都是灵异故事...
    其实就是一个线性递推,每次新增一个点判断一下是否行列被占用,未被占用的话就可以使得可行的行列-1.

    #include <bits/stdc++.h>
    #define ll long long
    using namespace std;
    inline int read () {
    	int q=0,f=1;char ch = getchar();
    	while(!isdigit(ch)){
    		if(ch=='-')f=-1;ch=getchar();
    	}
    	while(isdigit(ch)) {
    		q=q*10+ch-'0';ch=getchar();
    	}
    	return q*f;
    }
    bool line[100010];
    bool row[100010];
    int sum_row;
    int sum_lne;
    int main () {
    	int n = read(),m = read();
    	sum_row = n;
    	sum_lne = n;
    	for(int i = 1;i <= m; ++i) {
    		int x = read(),y = read();
    		if(!line[x]) {
    			line[x] = 1;
    			sum_lne --;
    		}
    		if(!row[y]) {
    			row[y] = 1;
    			sum_row --;
    		}
    		printf("%lld\n",(ll)sum_row * sum_lne);
    	}
    	return 0;
    }
    
  • 相关阅读:
    qt动态加载UI文件
    Qt常见控件和操作
    MySQL
    tomcat
    linux iptables基础
    linux 网络基础
    linux CA及OpenSSL学习
    k8s 访问控制
    k8s 存储卷
    docker 安装部署
  • 原文地址:https://www.cnblogs.com/akoasm/p/9584878.html
Copyright © 2011-2022 走看看