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

#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. JPA 系列教程5-双向一对多

    双向一对多的ddl语句 同单向多对一,单向一对多表的ddl语句一致 Product package com.jege.jpa.one2many; import javax.persistence.En ...

  2. VideoView的视频播放

    //-------------onCreate方法中----------------------- VideoView video_view = (VideoView) findViewById(R. ...

  3. hdu 2612(Find a way)(简单广搜)

    Find a way Time Limit : 3000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Su ...

  4. Android真机连接手机Target显示unknown cmd命令下adb devices 显示offline

    主要原因是adb版本的问题: 1.找到adb.exe路径  比如:G:\BaiduYunDownload\Android\android-sdk\platform-tools,将该路径放到环境便利-- ...

  5. C#无边框窗体移动 将事件绑定到想实现的控件上

    [DllImport("user32.dll")] public static extern bool ReleaseCapture(); [DllImport("use ...

  6. HDU 2609 How many

    最小表示法+Map或者字典树,最小表示法找了个模板,还没学习呢... #include<cstdio> #include<cstring> #include<cmath& ...

  7. mysql笔记7之数据类型

    1 区别一: varchar:可变长度的字符串.根据添加的数据长度决定占用的字符数 char:固定长度的字符串 2区别二 int:没有限制 int(4):限制为4 3 区别三: 日期: date    ...

  8. zencart hosts本地解析

    C:\WINDOWS\system32\drivers\etc\hosts 127.0.0.1  www.aberc220.com   别人 192.168.1.64 www.aberc220.com ...

  9. Bootstrap 模态对话框只加载一次 remote 数据的解决办法 转载

    http://my.oschina.net/qczhang/blog/190215 摘要 前端框架 Bootstrap 的模态对话框,可以使用 remote 选项指定一个 URL,这样对话框在第一次弹 ...

  10. textbox文本键盘全选

    private void textBox1_KeyDown(object sender, KeyEventArgs e)        {            if (e.Modifiers == ...