content
stringlengths
263
5.24M
pred_label
stringclasses
1 value
pred_score_pos
float64
0.6
1
#include <iostream> int main() { int m = [](int x) { return [](int y) { return y * 2; }(x)+6; }(5); std::cout << "m:" << m << std::endl;    //输出m:16 std::cout << "n:" << [](int x, int y) { return x + y; }(5, 4) << std::endl; //输出n:9 auto gFunc = [](int x)...
__label__POS
0.858543
#include "stdio.h" #include <string> #include <iostream> using namespace std; class MyString { public: MyString() :m_pData(NULL), m_nLen(0) { cout << "MyString()" << endl; } MyString(const char *pStr) // 允许隐式转换 { cout << "MyString(const char *pStr)" << endl; m_nLen = strl...
__label__POS
0.983504
# 题目 给你二叉树的根结点 root ,请你将它展开为一个单链表: 展开后的单链表应该同样使用 TreeNode ,其中 right 子指针指向链表中下一个结点,而左子指针始终为 null 。 展开后的单链表应该与二叉树 先序遍历 顺序相同。   示例 1: 输入:root = [1,2,5,3,4,null,6] 输出:[1,null,2,null,3,null,4,null,5,null,6] 示例 2: 输入:root = [] 输出:[] 示例 3: 输入:root = [0] 输出:[0] 提示: 树中结点数在范围 [0, 2000] 内 -100 <= Nod...
__label__POS
1.00001
# 题目 ``` 给定两个大小为 m 和 n 的正序(从小到大)数组 nums1 和 nums2。 请你找出这两个正序数组的中位数,并且要求算法的时间复杂度为 O(log(m + n))。 你可以假设 nums1 和 nums2 不会同时为空。 示例 1: nums1 = [1, 3] nums2 = [2] 则中位数是 2.0 示例 2: nums1 = [1, 2] nums2 = [3, 4] 则中位数是 (2 + 3)/2 = 2.5 ``` # 参考答案 ```c++ class Solution { public: double findMedianSortedArrays(vector<int>...
__label__POS
1.000005
# 题目 给你一个正整数 n ,生成一个包含 1 到 n<sup>2</sup> 所有元素,且元素按顺时针顺序螺旋排列的 n x n 正方形矩阵 matrix 。 示例 1: ![image](https://user-images.githubusercontent.com/59190045/125052181-44649e00-e0d6-11eb-96cd-76ae7c798d1b.png) 输入:n = 3 输出:[[1,2,3],[8,9,4],[7,6,5]] 示例 2: 输入:n = 1 输出:[[1]]   提示: 1 <= n <= 20 # 参考答案 ```c++ cl...
__label__POS
1.00001
# 题目 给定一个包含非负整数的 m x n 网格 grid ,请找出一条从左上角到右下角的路径,使得路径上的数字总和为最小。 说明:每次只能向下或者向右移动一步。   示例 1: ![image](https://user-images.githubusercontent.com/59190045/125057143-817f5f00-e0db-11eb-9438-d7ba6aeb3997.png) 输入:grid = [[1,3,1],[1,5,1],[4,2,1]] 输出:7 解释:因为路径 1→3→1→1→1 的总和最小。 示例 2: 输入:grid = [[1,2,3],[4,5...
__label__POS
1.000008
# 题目 给定一个 m x n 二维字符网格 board 和一个字符串单词 word 。如果 word 存在于网格中,返回 true ;否则,返回 false 。 单词必须按照字母顺序,通过相邻的单元格内的字母构成,其中“相邻”单元格是那些水平相邻或垂直相邻的单元格。同一个单元格内的字母不允许被重复使用。 示例 1: ![image](https://user-images.githubusercontent.com/59190045/125073083-0d9a8200-e0ee-11eb-8ebc-34b5ffcc3efa.png) 输入:board = [["A","B","C","E"],["S","F","...
__label__POS
0.999948
# 题目 给你一个 m 行 n 列的矩阵 matrix ,请按照 顺时针螺旋顺序 ,返回矩阵中的所有元素。 示例 1: ![image](https://user-images.githubusercontent.com/59190045/125050540-9e646400-e0d4-11eb-9c1c-39d34183cfd3.png) 输入:matrix = [[1,2,3],[4,5,6],[7,8,9]] 输出:[1,2,3,6,9,8,7,4,5] 示例 2: ![image](https://user-images.githubusercontent.com/59190045/125050564-a58...
__label__POS
0.999993
# 题目 一些恶魔抓住了公主(P)并将她关在了地下城的右下角。地下城是由 M x N 个房间组成的二维网格。我们英勇的骑士(K)最初被安置在左上角的房间里,他必须穿过地下城并通过对抗恶魔来拯救公主。 骑士的初始健康点数为一个正整数。如果他的健康点数在某一时刻降至 0 或以下,他会立即死亡。 有些房间由恶魔守卫,因此骑士在进入这些房间时会失去健康点数(若房间里的值为负整数,则表示骑士将损失健康点数);其他房间要么是空的(房间里的值为 0),要么包含增加骑士健康点数的魔法球(若房间里的值为正整数,则表示骑士将增加健康点数)。 为了尽快到达公主,骑士决定每次只向右或向下移动一步。   编写一个函数来计算确保骑士能够拯救到公主所需的...
__label__POS
1.000008
//强类型枚举以及c++11对原有枚举类型的扩展 //声明强类型枚举,只需要在enum加上关键字class。 //enum class Type { General, Light, Medium, Heavy }; //优点: //(1)强作用域,强类型枚举成员的名称不会被输出到其父作用域空间 //(2)转换限制,强类型枚举成员的值不可以与整形隐式地相互转换 //(3)可以指定底层类型。强类型枚举默认的底层类型为int,但也可以显式地指定底层类型。 //比如: //enum class Type: char { General, Light, Medium, Heavy }; #include <iostream> using...
__label__POS
0.998892
# 题目 给定一个数组,它的第 i 个元素是一支给定的股票在第 i 天的价格。 设计一个算法来计算你所能获取的最大利润。你最多可以完成 两笔 交易。 注意:你不能同时参与多笔交易(你必须在再次购买前出售掉之前的股票)。 示例 1: 输入:prices = [3,3,5,0,0,3,1,4] 输出:6 解释:在第 4 天(股票价格 = 0)的时候买入,在第 6 天(股票价格 = 3)的时候卖出,这笔交易所能获得利润 = 3-0 = 3 。 随后,在第 7 天(股票价格 = 1)的时候买入,在第 8 天 (股票价格 = 4)的时候卖出,这笔交易所能获得利润 = 4-1 = 3 。 示例 ...
__label__POS
0.999994
# 题目 给你两个单链表的头节点 headA 和 headB ,请你找出并返回两个单链表相交的起始节点。如果两个链表没有交点,返回 null 。 图示两个链表在节点 c1 开始相交: ![image](https://user-images.githubusercontent.com/59190045/125157885-1186dc80-e1a0-11eb-833d-31eb6ebbd98e.png) 题目数据 保证 整个链式结构中不存在环。 注意,函数返回结果后,链表必须 保持其原始结构 。 示例 1: ![image](https://user-images.githubusercontent.com/591900...
__label__POS
1.000003
# 题目 给你一个数组 nums 和一个值 val,你需要 原地 移除所有数值等于 val 的元素,并返回移除后数组的新长度。 不要使用额外的数组空间,你必须仅使用 O(1) 额外空间并 原地 修改输入数组。 元素的顺序可以改变。你不需要考虑数组中超出新长度后面的元素。 说明: 为什么返回数值是整数,但输出的答案是数组呢? 请注意,输入数组是以「引用」方式传递的,这意味着在函数里修改输入数组对于调用者是可见的。 你可以想象内部操作如下: ``` // nums 是以“引用”方式传递的。也就是说,不对实参作任何拷贝 int len = removeElement(nums, val); // 在函数里修改输入数组对于调...
__label__POS
1.00001
# 题目 给定两个整数,被除数 dividend 和除数 divisor。将两数相除,要求不使用乘法、除法和 mod 运算符。 返回被除数 dividend 除以除数 divisor 得到的商。 整数除法的结果应当截去(truncate)其小数部分,例如:truncate(8.345) = 8 以及 truncate(-2.7335) = -2 示例 1: 输入: dividend = 10, divisor = 3 输出: 3 解释: 10/3 = truncate(3.33333..) = truncate(3) = 3 示例 2: 输入: dividend = 7, divis...
__label__POS
1.000006
//一个对象既是普通类型(Trivial Type)又是标准布局类型(Standard-layout Type)那么这个对象就是POD类型。 //为什么我们需要 POD 类型满足这些条件呢,POD 类型在源码层级的操作上兼容于 ANSI C。POD 对象与 C 语言中的 //对象具有一些共同的特性,包括初始化、复制、内存布局与寻址: //(1)可以使用字节赋值,比如用 memset、memcpy 对 POD 类型进行赋值操作; //(2)对 C 内存布局兼容,POD 类型的数据可以使用 C 函数进行操作且总是安全的; //(3)保证了静态初始化的安全有效,静态初始化可以提高性能,如将 POD 类型对象放入 BSS 段默认初始化为 0...
__label__POS
0.999412
# 题目 n 皇后问题 研究的是如何将 n 个皇后放置在 n×n 的棋盘上,并且使皇后彼此之间不能相互攻击。 给你一个整数 n ,返回所有不同的 n 皇后问题 的解决方案。 每一种解法包含一个不同的 n 皇后问题 的棋子放置方案,该方案中 'Q' 和 '.' 分别代表了皇后和空位。 示例 1: ![image](https://user-images.githubusercontent.com/59190045/125049551-aec80f00-e0d3-11eb-9bc9-7cb4443a7c61.png) 输入:n = 4 输出:[[".Q..","...Q","Q...","..Q."],[".....
__label__POS
0.999889
# 题目 给定一个数组,将数组中的元素向右移动 k 个位置,其中 k 是非负数。 示例 1: 输入: nums = [1,2,3,4,5,6,7], k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右旋转 1 步: [7,1,2,3,4,5,6] 向右旋转 2 步: [6,7,1,2,3,4,5] 向右旋转 3 步: [5,6,7,1,2,3,4] 示例 2: 输入:nums = [-1,-100,3,99], k = 2 输出:[3,99,-1,-100] 解释: 向右旋转 1 步: [99,-1,-100,3] ...
__label__POS
1.00001
# 题目 给你二叉树的根节点 root ,返回它节点值的 前序 遍历。 示例 1: ![image](https://user-images.githubusercontent.com/59190045/125155822-de8b1b80-e194-11eb-8b45-c9c80e6508bf.png) 输入:root = [1,null,2,3] 输出:[1,2,3] 示例 2: 输入:root = [] 输出:[] 示例 3: 输入:root = [1] 输出:[1] 示例 4: ![image](https://user-images.githubuserconte...
__label__POS
1.00001
# 题目 给你两棵二叉树的根节点 p 和 q ,编写一个函数来检验这两棵树是否相同。 如果两个树在结构上相同,并且节点具有相同的值,则认为它们是相同的。 示例 1: ![image](https://user-images.githubusercontent.com/59190045/125078545-1e9ac180-e0f5-11eb-888e-17efc6166806.png) 输入:p = [1,2,3], q = [1,2,3] 输出:true 示例 2: ![image](https://user-images.githubusercontent.com/59190045/125078556-...
__label__POS
0.999857
# 题目 给你一个有序数组 nums ,请你 原地 删除重复出现的元素,使每个元素 最多出现两次 ,返回删除后数组的新长度。 不要使用额外的数组空间,你必须在 原地 修改输入数组 并在使用 O(1) 额外空间的条件下完成。  说明: 为什么返回数值是整数,但输出的答案是数组呢? 请注意,输入数组是以「引用」方式传递的,这意味着在函数里修改输入数组对于调用者是可见的。 你可以想象内部操作如下: // nums 是以“引用”方式传递的。也就是说,不对实参做任何拷贝 int len = removeDuplicates(nums); // 在函数里修改输入数组对于调用者是可见的。 // 根据你...
__label__POS
1.00001
# 题目 现在你总共有 n 门课需要选,记为 0 到 n-1。 在选修某些课程之前需要一些先修课程。 例如,想要学习课程 0 ,你需要先完成课程 1 ,我们用一个匹配来表示他们: [0,1] 给定课程总量以及它们的先决条件,返回你为了学完所有课程所安排的学习顺序。 可能会有多个正确的顺序,你只要返回一种就可以了。如果不可能完成所有课程,返回一个空数组。 示例 1: 输入: 2, [[1,0]] 输出: [0,1] 解释: 总共有 2 门课程。要学习课程 1,你需要先完成课程 0。因此,正确的课程顺序为 [0,1] 。 示例 2: 输入: 4, [[1,0],[2,0],[3,1],[3,...
__label__POS
1.000006
# 题目 给你两个二进制字符串,返回它们的和(用二进制表示)。 输入为 非空 字符串且只包含数字 1 和 0。 示例 1: 输入: a = "11", b = "1" 输出: "100" 示例 2: 输入: a = "1010", b = "1011" 输出: "10101"   提示: * 每个字符串仅由字符 '0' 或 '1' 组成。 * 1 <= a.length, b.length <= 10^4 * 字符串如果不是 "0" ,就都不含前导零。 # 参考答案 ```c++ class Solution { public: string addBinary(string a,...
__label__POS
1.00001
# 题目 给定一个二叉树,判断其是否是一个有效的二叉搜索树。 假设一个二叉搜索树具有如下特征: * 节点的左子树只包含小于当前节点的数。 * 节点的右子树只包含大于当前节点的数。 * 所有左子树和右子树自身必须也是二叉搜索树。 示例 1: 输入: 2 / \ 1 3 输出: true 示例 2: 输入: 5 / \ 1 4 / \ 3 6 输出: false 解释: 输入为: [5,1,4,null,null,3,6]。 根节点的值为 5...
__label__POS
1.00001
# 题目 给定一个二叉树,返回其节点值的锯齿形层序遍历。(即先从左往右,再从右往左进行下一层遍历,以此类推,层与层之间交替进行)。 例如: 给定二叉树 [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7 返回锯齿形层序遍历如下: [ [3], [20,9], [15,7] ] # 参考答案 ```c++ class Solution { public: vector<vector<int>> zigzagLevelOrder(Tre...
__label__POS
1.000007
#include <iostream> using std::cout; using std::endl; using namespace std; //原始字符串(raw string)就是字符表示的就是自己,引号和斜杠均无需\进行转义,这在需要输出很多引号和斜杠代码中很方便。 //原始字符串是C++11新增的一个功能,程序中使用R"(a string)"来标识原始字符串: //原始字符串同时包含其它特点: //1. 字符串中的换行符将在屏幕上如实显示。 //2. 在表示字符串开头的"和(之间可以添加其它字符,不过必须在表示字符串结尾的)和"之间添加同样的字符。 string path = "C:\Program File...
__label__POS
0.9999
# 题目 A power network consists of nodes (power stations, consumers and dispatchers) connected by power transport lines. A node u may be supplied with an amount s(u) >= 0 of power, may produce an amount 0 max(u) of power, may consume an amount 0 max(u)) of power, and may deliver an amount d(u)=s(u)+p(u)-c(u) of power. Th...
__label__POS
0.670143
# 题目 The Eight Puzzle, among other sliding-tile puzzles, is one of the famous problems in artificial intelligence. Along with chess, tic-tac-toe and backgammon, it has been used to study search algorithms. The Eight Puzzle can be generalized into an M × N Puzzle where at least one of M and N is odd. The puzzle is cons...
__label__POS
0.93274
# 题目 Xiaoyao likes to play with pictures very much. When he got a picture, he will use rectangle selection tool to select an area ((x1, y1 ) to (x2, y2 ), inclusively) and perform these operations: Invert: For any pixel with value v in selected area, change v to -v.<br> Lighten: For any pixel with value v in selected ...
__label__POS
0.94933
# 题目 After having drifted about in a small boat for a couple of days, Akira Crusoe Maeda was finally cast ashore on a foggy island. Though he was exhausted and despaired, he was still fortunate to remember a legend of the foggy island, which he had heard from patriarchs in his childhood. This must be the island in the ...
__label__POS
0.63439
# 题目 We all understand that an integer set is a collection of distinct integers. Now the question is: given an integer set, can you find all its addtive equations? To explain what an additive equation is, let's look at the following examples:<br> 1+2=3 is an additive equation of the set {1,2,3}, since all the num...
__label__POS
0.99822
# 题目 Maybe you wonder what an annoying painting tool is? First of all, the painting tool we speak of supports only black and white. Therefore, a picture consists of a rectangular area of pixels, which are either black or white. Second, there is only one operation how to change the colour of pixels: Select a rectangula...
__label__POS
0.984089
# 题目 The relative frequency of characters in natural language texts is very important for cryptography. However, the statistics vary for different languages. Here are the top 9 characters sorted by their relative frequencies for several common languages: ``` English: ETAOINSHR German: ENIRSATUD French: EAISTNRUL Span...
__label__POS
0.975372
# 题目 The puzzle game of Sudoku is played on a board of N 2 × N 2 cells. The cells are grouped in N × N squares of N × N cells each. Each cell is either empty or contains a number between 1 and N 2. The sudoku position is correct when numbers in each row, each column and each square are different. The goal of the game ...
__label__POS
0.974751
# 题目 Lily runs a repairing company that services the Q blocks in the city. One day the company receives M repair tasks, the ith of which occurs in block pi , has a deadline ti on any repairman’s arrival, which is also its starting time, and takes a single repairman di time to finish. Repairmen work alone on all tasks a...
__label__POS
0.980615
#include <iostream> #include <memory> #include <string> int main() { struct S { std::string m{ "▄▀▄▀▄▀▄▀" }; }; constexpr int n {4}; alignas(alignof(S)) char out[n * sizeof(S)]; try { auto first {reinterpret_cast<S*>(out)}; auto last {first + n}; std::ranges::uninitia...
__label__POS
0.965739
<h1>2021年最新整理,名企校招(含技术细节)Java岗位。持续更新中...</h1> ----------- * [Java基础](https://github.com/0voice/develop_skill_tree/blob/main/java_skill_tree/README.md#Java基础) * [Java基础知识](https://github.com/0voice/develop_skill_tree/blob/main/java_skill_tree/README.md#Java基础知识) * [Java语言的特点](https://github.com/0voice/develop_skill...
__label__POS
0.76824
#include <iostream> #include <memory> #include <string> #include <cstring> int main() { struct S { std::string m{ "Default value" }; }; constexpr int n {3}; alignas(alignof(S)) unsigned char mem[n * sizeof(S)]; try { auto first {reinterpret_cast<S*>(mem)}; auto last {first + n}...
__label__POS
0.8926
# 题目 给定两个整数M,N,生成一个M*N的矩阵,矩阵中元素取值为A至Z的26个字母中的一个,A在左上角,其余各数按顺时针方向旋转前进,依次递增放置,当超过26时又从A开始填充。例如,当M=5,N=8时,矩阵中的内容如下: A B C D E F G H V W X Y Z A B I U J K L M N C J T I H G F E D K S R Q P O N M L 输入描述 M为行数,N为列数,其中M,N都为大于0的整数。 ...
__label__POS
0.998217
# 题目 Mirko works on a pig farm that consists of M locked pig-houses and Mirko can't unlock any pighouse because he doesn't have the keys. Customers come to the farm one after another. Each of them has keys to some pig-houses and wants to buy a certain number of pigs. All data concerning customers planning to visit the...
__label__POS
0.913909
# 题目 A word is called a palindrome if we read from right to left is as same as we read from left to right. For example, "dad", "eye" and "racecar" are all palindromes, but "odd", "see" and "orange" are not palindromes. Given n strings, you can generate n × n pairs of them and concatenate the pairs into single words. T...
__label__POS
0.987061
class Base { public: auto operator<=>(const Base&) const = default; }; std::strong_ordering operator <=>(const std::string& a, const std::string& b) { int cmp = a.compare(b); if (cmp < 0) return std::strong_ordering::less; else if (cmp > 0) return std::strong_ordering::greater; else return std::stro...
__label__POS
0.996243
# 题目 The least common multiple (LCM) of a set of positive integers is the smallest positive integer which is divisible by all the numbers in the set. For example, the LCM of 5, 7 and 15 is 105. Input Input will consist of multiple problem instances. The first line of the input will contain a single integer indicating...
__label__POS
0.999765
# 题目 The look and say sequence is defined as follows. Start with any string of digits as the first element in the sequence. Each subsequent element is defined from the previous one by "verbally" describing the previous element. For example, the string 122344111 can be described as "one 1, two 2's, one 3, two 4's, three...
__label__POS
0.996788
# 题目 Lazyman is going to join the programming contest! There are n problems in the contest. Because Lazyman is so lazy, he just tried each problem once and only once. However each problem in the contest may be not independent, it may have some relationship with other problems. So here is a propbility P n*n matrix. The ...
__label__POS
0.998696
# 题目 As editor of a small-town newspaper, you know that a substantial number of your readers enjoy the daily word games that you publish, but that some are getting tired of the conventional crossword puzzles and word jumbles that you have been buying for years. You decide to try your hand at devising a new puzzle of yo...
__label__POS
0.994538
# 题目 There are <var>n</var> people standing in a row. And There are <var>m</var> numbers, 1.2...m. Every one should choose a number. But if two persons standing adjacent to each other choose the same number, the number shouldn't equal or less than <var>k</var>. Apart from this rule, there are no more limiting condition...
__label__POS
0.988274
# 题目 As you know, writing programs is often far from being easy. Things become even harder if your programs have to be as fast as possible. And sometimes there is reason for them to be. Many large programs such as operating systems or databases have "bottlenecks" - segments of code that get executed over and over again...
__label__POS
0.865216
# 题目 Have you ever thought about comparing the weight of fruits? That’s what you should do in this problem! Given a series of fruit weight comparisons, you should anticipate the result of another comparison. In this problem, all fruits of the same kind are identical and have the same weights. Each fruit weight comparis...
__label__POS
0.978445
# 题目 There are some(N <= 600) obstacles on the plant which are parallel to the X or Y axis. They may intersect but never overlap. Each obstacle have a cost (C<sub>i</sub> <= 1000000) to cut through it once. Compute the minimum cost required to allow the people to travel anywhere in the plane. Cutting at any place of an...
__label__POS
0.967961
# 题目 Let a, b, c, d be integers. The complex number a+bj, where j 2 = -1, is a factor of c+dj, if there exist integers e and f such that c + dj = (a + bj)(e + fj). A complex number a + bj where a and b are integers is a Gaussian prime if the factors are 1, -1, -a - bj and a + bj only. The following are Gaussian prim...
__label__POS
0.954856
#include <iostream> #include <cstdlib> #include <ctime> #include <vector> #include <unistd.h> #include <limits> using namespace std; const string chars = "abcdefghijklmnopqrstuvwxy"; void print_menu() { cout << endl; cout << "Enter the command you want to execute:" << endl; cout << "[1] swap <index1> <...
__label__POS
0.987106
# 题目 Young cryptoanalyst Georgie is planning to break the new cipher invented by his friend Andie. To do this, he must make some linear transformations over the ring Z<sub>r</sub> = Z/rZ. Each linear transformation is defined by 2×2 matrix. Georgie has a sequence of matrices A<sub>1</sub> , A<sub>2</sub> ,..., A<sub>n...
__label__POS
0.979374
# 题目 A primitive cow culture was discovered by noted anthropologist Dr. Bo Vine. Hundreds of computation tablets were unearthed in a pasture somewhere near Dallas. Dr. Vine managed to decipher the mystery of the tablets when he realized they represented mathematical calculations. He says "I've always suspected that cow...
__label__POS
0.827108
# 题目 Have you done any Philately lately? You have been hired by the Ruritanian Postal Service (RPS) to design their new postage software. The software allocates stamps to customers based on customer needs and the denominations that are currently in stock. Ruritania is filled with people who correspond with stamp colle...
__label__POS
0.912005
# 题目 A bus ticket is called 'lucky', if in its number, which consists of 2n digits (the number may have leading zeros), the sum of the first n digits equals the sum of the last n digits. A passenger wants to certainly ride with a lucky ticket. He buys a ticket, checks its number, and then, if necessary, buys a few more...
__label__POS
0.995689
# 题目 After going through the receipts from your car trip through Europe this summer, you realised that the gas prices varied between the cities you visited. Maybe you could have saved some money if you were a bit more clever about where you filled your fuel? To help other tourists (and save money yourself next time), ...
__label__POS
0.990303
/* * Standard usb ethernet communications device. */ #include <u.h> #include <libc.h> #include <fcall.h> #include <thread.h> #include "usb.h" #include "usbfs.h" #include "ether.h" static int okclass(Iface *iface) { return Class(iface->csp) == Clcomms && Subclass(iface->csp) == Scether; } static int getmac(Ether *e...
__label__POS
0.661485
# 题目 Given a simple connected undirected graph with n vertices and m edges, where m is even, your task is to find a pairing of the edges such that each pair of edges shares a vertex. 输入描述 The input contains exactly one test cases. On the first line of the test case there are two integers n and m (3 ≤ n ≤ 20,000, 2 ≤ ...
__label__POS
0.988218
# 题目 Background "KO-RE-A, KO-RE-A" shout 54.000 happy football fans after their team has reached the semifinals of the FIFA World Cup in their home country. But although their excitement is real, the Korean people are still very organized by nature. For example, they have organized huge trumpets (that sound like blowi...
__label__POS
0.976384
# 题目 Let us consider undirected graph G = <v e=""> which has N vertices and M edges. Incidence matrix of this graph is N * M matrix A = {a<sub>ij</sub>}, such that aij is 1 if i-th vertex is one of the ends of j-th edge and 0 in the other case. Your task is to find the sum of all elements of the matrix A<sup>T</sup>A.<...
__label__POS
0.999585
# 题目 The <dfn>D-pairs</dfn> of a string of letters are the ordered pairs of letters that are distance D from each other. A string is <dfn>D-unique</dfn> if all of its D-pairs are different. A string is <dfn>surprising</dfn> if it is D-unique for every possible distance D. Consider the string ZGBG. Its 0-pairs are ZG, ...
__label__POS
0.982777
#include <cstring> #include <iostream> #include <memory> #include <string> int main() { struct S { std::string m{ "▄▀▄▀▄▀▄▀" }; }; constexpr int n {4}; alignas(alignof(S)) char out[n * sizeof(S)]; try { auto first {reinterpret_cast<S*>(out)}; auto last {first + n}; st...
__label__POS
0.942566
#include <cstring> #include <iostream> #include <memory> #include <string> int main() { struct S { std::string m{ "█▓▒░ █▓▒░ " }; }; constexpr int n {4}; alignas(alignof(S)) char out[n * sizeof(S)]; try { auto first {reinterpret_cast<S*>(out)}; auto last = std::ranges::uninitia...
__label__POS
0.950589
# 题目 Find and list all four-digit numbers in decimal notation that have the property that the sum of its four digits equals the sum of its digits when represented in hexadecimal (base 16) notation and also equals the sum of its digits when represented in duodecimal (base 12) notation. For example, the number 2991 has t...
__label__POS
0.886318
# 题目 The Happy Worm lives in an m*n rectangular field. There are k stones placed in certain locations of the field. (Each square of the field is either empty, or contains a stone.) Whenever the worm sleeps, it lies either horizontally or vertically, and stretches so that its length increases as much as possible. The wo...
__label__POS
0.990579
# 题目 N cities (2 ≤ N ≤ <nobr>10 000</nobr>) are connected by a network of M one-way roads (1 ≤ M < <nobr>100 000 000</nobr>). It is known that these roads do not cross outside the cities. The numeration of the cities and the roads starts from 1.There is at most one road from any city to another one. The length of each ...
__label__POS
0.985856
# 题目 Consider the two networks shown below. Assuming that data moves around these networks only between directly connected nodes on a peer-to-peer basis, a failure of a single node, 3, in the network on the left would prevent some of the still available nodes from communicating with each other. Nodes 1 and 2 could stil...
__label__POS
0.758616
#include <iostream> #include <memory> #include <string> int main() { struct S { std::string m{ "Default value" }; }; constexpr int n {3}; alignas(alignof(S)) unsigned char mem[n * sizeof(S)]; try { auto first {reinterpret_cast<S*>(mem)}; auto last = std::uninitialized_default_c...
__label__POS
0.909804
#include <iostream> #include <memory> #include <string> int main() { struct S { std::string m{ "█▓▒░ █▓▒░ █▓▒░ " }; }; constexpr int n {4}; alignas(alignof(S)) char out[n * sizeof(S)]; try { auto first {reinterpret_cast<S*>(out)}; auto last = std::ranges::uninitialized_value_co...
__label__POS
0.961949
# 题目 Tomy's fond of a game called 'Fans and Gems' (also known as Gravnic). In the game, he can use fans to collect gems, but he's satisfied with his play only if all the gems are collected with minimal number of steps. The game is played as following: ![image](https://user-images.githubusercontent.com/59190045/1245774...
__label__POS
0.657065
/* * usb/print - usb printer file server * BUG: Assumes the printer will be always connected and * not hot-plugged. (Otherwise should stay running and * listen to errors to keep the device there as long as it has * not failed). Also, this is untested and done ad-hoc to * replace the print script. */ #include <u....
__label__POS
0.776688
# 题目 There are two dice and there is one number on each side. The range of number is [0, 9]. Now, I want to know whether these dice are<br> a) Same<br> b) Reflection<br> c) Different<br> If two dice are both Same and Reflection, we just think they are Same. Each Dice will be given in its stretch out view. Just like ...
__label__POS
0.892454
template<class T> class P1 { public: explicit P1(T* p) : p_(p) { } T* operator->() const noexcept { return p_; } private: T* p_; }; template<class T> class P2 { public: explicit P2(T* p) : p_(p) { } P1<T> operator->() const noexcept { return p_; } private...
__label__POS
0.719993
from pwn import * from struct import pack, unpack #context.log_level = "debug" #p = remote("aes-128-tsb.hackable.software",1337) p = remote("localhost",1337) def xor(a, b): assert len(a) == len(b) return ''.join([chr(ord(ai)^ord(bi)) for ai, bi in zip(a,b)]) def pad(msg): byte = 16 - len(msg) % 16 ret...
__label__POS
0.658471
# 题目 Introduction You've been a treasure hunter for a long time. You're pretty good at disarming traps, sneaking past the natives, and generally getting the goods while leaving your skin intact. That stuff doesn't really worry you, but what really raises a sweat is after each expedition there are always very tense ar...
__label__POS
0.787511
# 题目 You are appointed director of a famous concert hall, to save it from bankruptcy. The hall is very popular, and receives many requests to use its two fine rooms, but unfortunately the previous director was not very efficient, and it has been losing money for many years. The two rooms are of the same size and arrang...
__label__POS
0.753462
__author__ = "polaris" from pwn import * from struct import pack, unpack #context.log_level = "debug" p = remote("aes-128-tsb.hackable.software",1337) #p = remote("localhost",1337) def xor(a, b): assert len(a) == len(b) return ''.join([chr(ord(ai)^ord(bi)) for ai, bi in zip(a,b)]) def pad(msg): byte = 16...
__label__POS
0.650782
# 题目 As a freshman of grave robbery, you luckily sneaked into the tomb of a great ancient emperor, and soon found the treasure room of it. After a great surprise at the valuable jewels and gold plates, you quickly recognized that it is not so easy at all: there're many traps at the door of the treasure room which were ...
__label__POS
0.910102
# 题目 Given a set of sticks of various lengths, is it possible to join them end-to-end to form a square? 输入描述 The first line of input contains N, the number of test cases. Each test case begins with an int 输出描述 For each case, output a line containing "yes" if is is possible to form a square; otherwise output "no". ...
__label__POS
0.980175
# 题目 The author of an elementary school algebra text book has approached you to write a program to solve simple algebra equations. The author wants to use a program to avoid human errors in preparing the solutions manual. The text book author will provide a text file of the simple problems for your problem to solve. Al...
__label__POS
0.938918
# 题目 River polution control is a major challenge that authorities face in order to ensure future clean water supply. Sewage treatment plants are used to clean-up the dirty water comming from cities before being discharged into the river. As part of a coordinated plan, a pipeline is setup in order to connect cities to ...
__label__POS
0.919176
# 题目 Actually, this problem is about alignment of N (1<br> Bessie looks up and notices that she is exactly lined up with Sara and Julie. She wonders how many groups of three aligned cows exist within the field. Given the locations of all the cows (no two cows occupy the same location), figure out all sets of three cow...
__label__POS
0.925549
# 题目 One of the traps we will encounter in the Pyramid is located in the Large Room. A lot of small holes are drilled into the floor. They look completely harmless at the first sight. But when activated, they start to throw out very hot java, uh ... pardon, lava. Unfortunately, all known paths to the Center Room (where...
__label__POS
0.754893
# 题目 Advanced Cargo Movement, Ltd. uses trucks of different types. Some trucks are used for vegetable delivery, other for furniture, or for bricks. The company has its own code describing each type of a truck. The code is simply a string of exactly seven lowercase letters (each letter on each position has a very specia...
__label__POS
0.812624
# 题目 Many people like to solve hard puzzles some of which may lead them to madness. One such puzzle could be finding a hidden prime number in a given text. Such number could be the number of different substrings of a given size that exist in the text. As you soon will discover, you really need the help of a computer an...
__label__POS
0.989658
# 题目 Estelle Bright goes to Casino & Bar Lavantar to gamble. Among all the games, playing Poker is most possible to make much money (which is called Mira here), so Estelle decide to play this. But gambling has never been easy. Fortunately, with the help of Scherazard Harvey, she can know the queue of coming cards. Howe...
__label__POS
0.829071
# 题目 Suppose there are <var>N</var> people in ZJU, whose ages are unknown. We have some messages about them. The <var>i</var>-th message shows that the age of person <var>si</var> is not smaller than the age of person <var>ti</var>. Now we need to divide all these <var>N</var> people into several groups. One's age shou...
__label__POS
0.999227
# 题目 There is a group of N bakers in the town of Utopia. These bakers hold a monthly celebration in which they award a prize to some of the luckier among themselves. These lucky guys are chosen as follows: In the beginning there are some chalk marks on some of the bakers' houses. Each baker has a list of his/her favor...
__label__POS
0.857126
# 题目 Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting the segments of different colors you can see at last. Input The first line of each data set contains exactly one integer n, 1 <= n <= 8000, equal to the number of colored s...
__label__POS
0.931243
# 题目 Digital deletions is a two-player game. The rule of the game is as following. Begin by writing down a string of digits (numbers) that's as long or as short as you like. The digits can be 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 and appear in any combinations that you like. You don't have to use them all. Here is an example: ...
__label__POS
0.990737
# 题目 Count the number of permutations that have a specific number of inversions. Given a permutation a1, a2, a3,..., an of the n integers 1, 2, 3, ..., n, an inversion is a pair (ai, aj) where i aj. The number of inversions in a permutation gives an indication on how "unsorted" a permutation is. If we wish to analyze t...
__label__POS
0.998581
#!/usr/bin/env python # coding=utf-8 # author: seabreeze from random import choice from pwn import * #context.log_level = 'debug' # r = process('./unconditional_security') r = remote('117.50.21.216', 9705) def test(p, solved=None): global idx tmp = bytearray([p[i] if i in p else '2' for i in xrange(1024)]) ...
__label__POS
0.965337
# 题目 The USA Computer Security Office claims that the terrorist attack on 11th of September could not be scheduled without the help of scheduler programs that minimize the period of hijacking 4 plan es and tower crashing. To check this claim, Information Ministry decided to write such a program and check if the result ...
__label__POS
0.693229
# 题目 You are given a row of m stones each of which has one of k different colors. What is the minimum number of stones you must remove so that no two stones of one color are separated by a stone of a different color? 输入描述 The input test file will contain multiple test cases. Each input test case begins with a single ...
__label__POS
0.995181
# 题目 Chip and Dale have devised an encryption method to hide their (written) text messages. They first agree secretly on two numbers that will be used as the number of rows (R) and columns (C) in a matrix. The sender encodes an intermediate format using the following rules: 1. The text is formed with uppercase letter...
__label__POS
0.931076
#!/usr/bin/env python # encoding: utf-8 __author__ = 'b1gtang' from pwn import * context.terminal = ['tmux', 'splitw', '-h'] context.arch = 'amd64' BINARY = './revenge' TARGET = ('127.0.0.1', 2333) if args.R: r = remote(TARGET[0], TARGET[1]) else: r = process(BINARY) def attach(addr): if addr <= ...
__label__POS
0.927173
from pwn import * #context.log_level = 'debug' ccc = [0 for i in range(13)] #alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" #alpha += "abcdefghijklmnopqrstuvwxyz" #alpha += "_1234567890" alpha = "0123456789" alpha += "abcdef" def enc_one(r,data): r.recvuntil("option:\n") r.sendline("1") r.recvuntil("text:\n") r....
__label__POS
0.770487
/************************************************************************* > File Name: map.cpp > Author: > Mail: > Created Time: Fri Jul 6 14:32:47 2018 ************************************************************************/ #include<iostream> #include<cstdlib> #include<map> #include<gmp.h> #define ll long ...
__label__POS
0.999285
# 题目 Well known Las-Vegas casino "Big Jo" has recently introduced the new playing machine, called Magic Multiplying Machine (MMM). MMM has N levers and one big red button. Each lever is marked with some integer number ranging from 1 to M, thus i-th lever is marked with number ai. A player who wishes to play on MMM ins...
__label__POS
0.943916
# 题目 "PATH" is a game played by two players on an N by N board, where N is a positive integer. (If N = 8, the board looks like a chess board.) Two players "WHITE" and "BLACK" compete in the game to build a path of pieces played on the board from the player's "home" edge to the player's "target" edge, opposite the home ...
__label__POS
0.831184