当前位置: 首页 > news >正文

学校网站建设运行情况简介网站设计与运营

学校网站建设运行情况简介,网站设计与运营,温州自媒体公司,企业宣传视频制作免费模板有一个长度为L厘米板,L是一个正整数,所以我们可以把它均匀地划分成L个部分,分别从左到右编号为1,2……L,每一个部分长度都为1厘米。现在我们必须给每个部分涂色,一个部分一种颜色,要求完成以下两…

有一个长度为L厘米板,L是一个正整数,所以我们可以把它均匀地划分成L个部分,分别从左到右编号为1,2……L,每一个部分长度都为1厘米。现在我们必须给每个部分涂色,一个部分一种颜色,要求完成以下两种操作:   1.“C A B C1”:表示从A部分到B部分涂上C1颜色。   2.“P A B”:表示从A部分到B部分涂了几种颜色。   在我们的日常生活中,我们有非常少几种颜色(红色,绿色,蓝色,黄色...),所以你可以假设不同颜色的总数T是非常少。简单地说,我们表示颜色的名称为颜色1,颜色2,…..颜色T。最初时候,这个厘米版都涂成颜色1。

思路

由于颜色很少,所以说可以给他状态压缩成一个数。

也就是支持一下几个操作:
1.区间或上1<<k

2.查询区间的或值

然后用线段树做就可以了。

懒标记更新有一点不一样。

// C++ includes used for precompiling -*- C++ -*-// Copyright (C) 2003-2021 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library.  This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
// <http://www.gnu.org/licenses/>./** @file stdc++.h*  This is an implementation file for a precompiled header.*/// 17.4.1.2 Headers// C
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cuchar>
#endif// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif#if __cplusplus >= 201402L
#include <shared_mutex>
#endif#if __cplusplus >= 201703L
#include <any>
#include <charconv>
// #include <execution>
#include <filesystem>
#include <optional>
#include <memory_resource>
#include <string_view>
#include <variant>
#endif#if __cplusplus > 201703L
#include <barrier>
#include <bit>
#include <compare>
#include <concepts>
#if __cpp_impl_coroutine
# include <coroutine>
#endif
#include <latch>
#include <numbers>
#include <ranges>
#include <span>
#include <stop_token>
#include <semaphore>
#include <source_location>
#include <syncstream>
#include <version>
#endif
//以上为万能头(POJ不能直接用,差评)
using namespace std;
const int N = 1000010;
int w[N];
struct owl {int l, r, v, q;
} tr[N * 4];
void pushup(int u) {tr[u].v = tr[u << 1].v | tr[u << 1 | 1].v;
}
void pushdown(int u) {tr[u].q = 0;tr[u << 1].q = tr[u << 1 | 1].q = 1;tr[u << 1].v = tr[u << 1 | 1].v = tr[u].v;
}
void build(int u, int l, int r) {tr[u].l = l;tr[u].r = r;if (l == r) {tr[u].v = 1;return ;}int mid = l + r >> 1;build(u << 1, l, mid), build(u << 1 | 1, mid + 1, r);pushup(u);
}
int query(int u, int l,int r) {if (tr[u].q){return tr[u].v;}if (tr[u].l >= l && tr[u].r <= r){return tr[u].v;}int mid = tr[u].l + tr[u].r >> 1;if (r <= mid){return query(u << 1,l,r);}else if (l > mid){return query(u << 1 | 1,l,r);}else{return query(u << 1,l,mid) | query(u << 1 | 1,mid + 1,r);}
}
void modify(int u, int l, int r, int v) {if (tr[u].q) {pushdown(u);}if (tr[u].l >= l && tr[u].r <= r) {tr[u].v = 1 << (v - 1);tr[u].q = 1;return ;}int mid = tr[u].l + tr[u].r >> 1;if (r <= mid){modify(u << 1,l,r,v);}else if (l > mid){modify(u << 1 | 1,l,r,v);}else{modify(u << 1,l,r,v);modify(u << 1 | 1,l,r,v);}pushup(u);
}
int main() {ios::sync_with_stdio(false);cin.tie(0), cout.tie(0);int L,T,M;cin >> L >> T >> M;build(1,1,L);while (M -- ){char op;cin >>op;if (op == 'C'){int l,r,c;cin >> l >> r >> c;if (l> r){swap(l,r);}modify(1,l,r,c);}else{int l,r;cin >> l >> r;if (l > r){swap(l,r);}int t = query(1,l,r);
//			cout << t << endl;int res = 0;for (int i = 0; i < T; i ++ ){if (t & ((1 << i))){res ++ ;}}cout << res << "\n";}}return 0;
}
http://www.yayakq.cn/news/395084/

相关文章:

  • 网站建设 海拉尔seo建设
  • 在线查看qq空间网站12306网站能不能用银河二计算机做服务器啊慢得要死
  • 黑龙江做网站公司网站菜单导航
  • 致力于网站建设网站开发 发表文章
  • 长沙哪里可以做网站建设优化网站
  • 有什么网站可以做团购深圳人才市场招聘信息
  • 做网站必须有框架么徐州市徐州市城乡建设局网站首页
  • vpn网站模板如何做百度搜索推广
  • 网站建设企业建站要多久tp5手机网站开发
  • 山西旅游网站建设深圳网站备案拍照点
  • 网站地图定位怎么做个人社保缴费app下载
  • 保健品网站dede模板上海东方网首页
  • 菏泽 做网站 多少钱wordpress html调用php
  • 做的视频发到哪个网站山西cms建站系统价格
  • 怎么查网站是那个公司做的美丽乡村网站建设模板
  • 如何打破违法网站wordpress过时了吗
  • 宿州网站开发建设中山网站建设文化教程
  • 网站安全检测软件个人主页网页设计源代码
  • wix做的网站在国内访问不了口碑营销属于什么营销
  • 企业做网站推广科技公司简介范文
  • 建设执业资格注册管理中心网站磐安建设局网站
  • 网站建设的背景意义建设官网登录
  • 国内网站开发的主流技术上海公共招聘网官网下载
  • 做义工的网站幽默软文广告经典案例
  • 企业信息管理系统的发展历程seo的优化技巧有哪些
  • 网站制作大概需要多少钱手机网站列表 教程
  • 网站流量查询服务平台网络营销案例2022
  • 杭州网站推广公司破天网站定制
  • php做网站技术方案wordpress调用列表页
  • 美橙域名查询网站长沙做网站nn微联讯点很好