Educational Codeforces Round 58 (Rated for Div. 2) E. Polycarp's New Job
題解
題目大意 +表示增加一個矩形 ?表示查詢 設錢包能無限疊加的裝正方形問當前大小的錢包是否能把所有矩形裝入
將所給xy調整為高<寬 記錄一個最大的高度 一個最大的寬度 查詢時比較高寬即可
AC程式碼
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
int main()
{
#ifdef LOCAL
//freopen("C:/input.txt", "r", stdin);
#endif
int n;
cin >> n;
int h = 0, w = 0, x, y;
char c;
for (int i = 0; i < n; i++)
{
scanf(" %c%d%d", &c, &x, &y);
if (x > y)
swap(x, y); //將x改為較小的
if (c == '+')
h = max(x, h), w = max(w, y);
else
cout << (x >= h && y >= w ? "YES" : "NO" ) << endl;
}
return 0;
}
相關推薦
Educational Codeforces Round 58 (Rated for Div. 2) E. Polycarp39;s New Job
題解 題目大意 +表示增加一個矩形 ?表示查詢 設錢包能無限疊加的裝正方形問當前大小的錢包是否能把所有矩形裝入 將所給xy調整為高<寬 記錄一個最大的高度 一個最大的寬度 查詢時比較高寬即可 AC程式碼 #include <stdio.h> #include
Educational Codeforces Round 58 (Rated for Div. 2) (題解)
C題卡了一個小時, 又被教育場教育了... A. Minimum Integer 大意:求不在$[l,r]$範圍內的最小被$d$整除的數 模擬 #include <iostream> #define REP(i,a,n) for(int i=
Educational Codeforces Round 58 (Rated for Div. 2) D.GCD Counting(樹的直徑+gcd)
題意 思路來源 Codeforce__JuRuo 題解 將每個gcd分解素因子放入對應vector 相當於對每個素因子建了一棵樹 遍歷每個素因子的樹,尋找直徑,更新答案 注意C++11的寫法 好好學學 會省不少功夫 還有一些技巧性寫法 加油! 程式碼
Educational Codeforces Round 58 (Rated for Div. 2)(待更新)
force ont div code union ems www. ble ces get人生第七場CF! 成績:(exACM) rank AC3/7 Penalty104 rating() 題目:Educational Codeforces Round 58 (Rate
Educational Codeforces Round 58 (Rated for Div. 2) (前兩題題解)
感慨 這次比較昏迷最近演算法有點飄,都在玩pygame。。。做出第一題讓人hack了,第二題還昏迷想錯了 A Minimum Integer(數學) 水題,上來就能做出來但是讓人hack成了tle,所以要思考一下具體的過程 原本我是認為直接把d進行累加看什麼時候不在那個segment內也就是那個範圍之
Educational Codeforces Round 58 (Rated for Div. 2)
昨晚太太天真題目雖然簡單但是方法用的很蠢。。。。 A(簡單數學) #include<stdio.h> int n,l,r,p; main() { scanf("%d",&n); while(n--) { scanf("%d%d%d",&l,&r,
Educational Codeforces Round 58 (Rated for Div. 2) 題解
註意 accordion char color ces nbsp cdb 字符 bre Educational Codeforces Round 58 (Rated for Div. 2) 題目總鏈接:https://codeforces.com/contest/110
Educational Codeforces Round 58 (Rated for Div. 2) A. Minimum Integer
題解 題目大意 讓你找到最小的能被d整除且不在[l, r]範圍內的數字 考慮小於l的情況 最小為d 大於r的情況 (r/d+1)*d第一個大於r的d的倍數 AC程式碼 #include <stdio.h> #include <bits/stdc++.h>
Educational Codeforces Round 58 (Rated for Div. 2)(B. Accordion)
B. Accordion time limit per test3 seconds memory limit per test256 megabytes inputstandard input
Educational Codeforces Round 58 (Rated for Div. 2)(A. Minimum Integer)
A. Minimum Integer time limit per test:1 second memory limit per test:256 megabytes input:standard input
Educational Codeforces Round 44 (Rated for Div. 2)+E. Pencils and Boxes+樹狀數組
namespace 超過 closed .com 樹狀數組 最小 %d lse pre 題目鏈接:E. Pencils and Boxes 題意:N 個數,要求分成任意堆,要求每一堆只要有K個,同一堆中任意數之間差值不能超過d; 題解:用樹狀數組。排一下序然後從後面開始
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes
problem 滿足 names fort determine resp binary nat 題意 Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 題目
Educational Codeforces Round 53 (Rated for Div. 2) E. Segment Sum
https://codeforces.com/contest/1073/problem/E 題意 求出l到r之間的符合要求的數之和,結果取模998244353 要求:組成數的數位所用的數字種類不超過k種 思路 這題一看就是個數位dp的模板題,但是由於以前沒有完全理解數位dp加上xjb套模版,導致樣例都
【Educational Codeforces Round 54 (Rated for Div. 2) E. Vasya and a Tree】 dfs+樹狀陣列
E. Vasya and a Tree 題意 給 你 一
【Educational Codeforces Round 53 (Rated for Div. 2) E. Segment Sum】 數位DP
E. Segment Sum 題意 題 意 很
Educational Codeforces Round 54 (Rated for Div. 2) E. Vasya and a Tree(dfs+思維)
E. Vasya and a Tree time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output
【Educational Codeforces Round 55 (Rated for Div. 2) E. Increasing Frequency】滾動陣列優化暴力
E. Increasing Frequency 題意 給你一個數列,你可以選擇在[l,r]區間同時加或者減一個值, 在一次操作後,這個序列最多有多少個值等於c 做法 首先我們要想明白的是,a[l]一定是等於a[r]的 如果a[l]!=a[r],那麼我們肯定可以縮小這個區間,
Educational Codeforces Round 55 (Rated for Div. 2) E - Increasing Frequency(列舉+尺取)
題意 n個數,一個c值, 允許改一次區間[l,r],即把這個區間內的數同時加上或減去一個k, 問修改之後,最多有多少個c值。 思路來源 翼神%%% 題解 列舉哪個值是最後是替代c的值 c顯然不需要替代自己,預處理一下[0,n-1]區間有幾個c 對每個值跑一遍
Educational Codeforces Round 51 (Rated for Div. 2)E. Vasya and Big Integers(二分雜湊+差分)
題目傳送門 題意 給出長度小於等於10610^6106的數字串a,l,r,求把串a拆分後,每段數字大小都是≥l\geq l≥l並且≤r\leq r≤r的方案有多少種。 分析 首先我們可以發現一個很顯然的結論,即如果從第i位開始截成一段,那麼這一
Educational Codeforces Round 56 (Rated for Div. 2) E. Intersection of Permutations(分塊 + 樹狀陣列)
題目連結:https://codeforces.com/contest/1093/problem/E 題目大意:給出兩個1~n的排列 a 和 b;對這兩個排列進行如下兩種操作: 1 la ra lb rb:查詢排列 a 的區間 [la,ra]