对于每一个格子,看是行最后画还是列最后画。预处理一下就可以了。

#include<stdio.h>
#include<string.h> int n,m,k;
int op[+];
int id[+];
int info[+];
int high[+]; int main()
{
scanf("%d%d%d",&n,&m,&k);
memset(high,-,sizeof high); for(int i=;i<=k;i++)
scanf("%d%d%d",&op[i],&id[i],&info[i]); for(int i=k;i>=;i--)
{
int y;
if(op[i]==) y=id[i];
else y=id[i]+n; if(high[y]==-) high[y]=i;
} for(int i=;i<=n;i++)
{
for(int j=;j<=m;j++)
{
if(high[i]==-&&high[j+n]==-) printf("0 ");
else if(high[i]==-&&high[j+n]!=-) printf("%d ",info[high[j+n]]);
else if(high[i]!=-&&high[j+n]==-) printf("%d ",info[high[i]]);
else
{
if(high[i]>high[j+n]) printf("%d ",info[high[i]]);
else printf("%d ",info[high[j+n]]);
}
}
printf("\n");
}
return ;
}

CodeForces 631B Print Check的更多相关文章

  1. Codeforces 631B Print Check (思维)

    题目链接 Print Check 注意到行数加列数最大值只有几千,那么有效的操作数只有几千,那么把这些有效的操作求出来依次模拟就可以了. #include <bits/stdc++.h> ...

  2. Codeforces 631B Print Check【模拟】

    题意: 按顺序给定列和行进行涂色,输出最终得到的方格颜色分布. 分析: 记录下涂的次序,如果某个元素的横和列都被涂过,那么就选择次序最大的颜色. 代码: #include<iostream> ...

  3. CodeForces 631C Print Check

    排序+构造+预处理 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm ...

  4. codeforces 631B B. Print Check

    B. Print Check time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  5. Codeforces Round #344 (Div. 2) B. Print Check 水题

    B. Print Check 题目连接: http://www.codeforces.com/contest/631/problem/B Description Kris works in a lar ...

  6. Codeforces Round #344 (Div. 2) B. Print Check

    B. Print Check time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  7. Codeforces Round #344 (Div. 2) 631 B. Print Check (实现)

    B. Print Check time limit per test1 second memory limit per test256 megabytes inputstandard input ou ...

  8. 存储构造题(Print Check)

    连接:Print Check 题意:n行m列的矩阵,有k次涂色,每一涂一行或者一列,求最后的涂色结果. 从数据的大小看,暴力肯定要TLE: 问题是如何存储数据. 首先:我们只要最后的涂色结果. 其次: ...

  9. Codeforces - 631B 水题

    注意到R和C只与最后一个状态有关 /*H E A D*/ struct node2{ int kind,las,val,pos; node2(){} node2(int k,int l,int v,i ...

随机推荐

  1. 扫描局域网内的ip和主机名

    1. 目的 今天发现我配置的一台电脑ip被人占用了,所以准备写个程序扫描一下局域网内所有正在使用的ip和主机名 2. 实现--直接上代码 import time import threading im ...

  2. android-misc-widgets四向(上下左右)抽屉bug修复版--转载

     android-misc-widgets四向(上下左右)抽屉bug修复版 2013-08-04 08:58:13 标签:bug down top panel slidingdrawer 原创作品,允 ...

  3. monkeyrunner对比屏幕局部图像.getSubImage()

    monkeyrunner对比屏幕局部图像.getSubImage() monkeyrunner执行测试时使用.takeSnapshot()截图,默认截取整个屏幕,包含了系统的状态栏.真实手机状态栏中包 ...

  4. 【Qt开发】修改源码文件的编码格式的小技巧 .

    默认情况下,代码文件应该以utf-8的格式来存储的.而如果在代码文件的转移或者上传下载过程中,弄乱了文件的编码格式,一般会出现乱码的情况. 例如windows系统下,中文就很容易出现乱码,如下图,文件 ...

  5. Linux + Apache + PHP 环境搭建

    搭建环境: Ubuntu 15.04 Apache 2.4.16 PHP 5.6.15 1 安装Apache 先安装依赖程序(都安装在 /usr/local/ 目录下) apr-1.5.2.tar.g ...

  6. Python -- lambda, map, filter

    lambda f = lambda x : x * 2 f(5) f = lambda x,y,z : x+y+z f(2,1,3) map list(map(lambda x:x[0].upper( ...

  7. Windows API 之 CreateThread、WaitForSingleObject(未完)

    WaitForSingleObject Waits until the specified object is in the signaled state or the time-out interv ...

  8. JavaScript基础教程

    功能介绍: (1)数据验证 弹出提示的对话框,产生判断的效果. (2)气泡提示窗口 右下角等等一类的窗口 (3)产生新窗口 (4)无边框窗口背景变灰,也是可以节约系统资源的

  9. angular实现select的ng-options

    html <div ng-controller="ngSelect"> <select ng-model="vm.selectVal" ng- ...

  10. angularjs ng-switch

    <p> <a href="#" ng-click="toggle()">Toggle Section</a> </p& ...