uuid
string
repo_name
string
relative_path
string
content
string
category
string
algo_rel_score
float64
quality_score
float64
9033ddd5-e2c1-4cbb-a80b-77962b5b8222
suuman/selectKeyImagesLines
linematching/Linematching_iso/edlbd/EDLineDetector.cpp
/* * EDLineDetector.cpp * * Created on: Nov 30, 2011 * Author: lz */ /*----------------------------------------------------------------------------------- Updates => modified to use open cv image as input */ #include "EDLineDetector.hh" //#include <highgui.h> #include <opencv2/imgproc/imgproc_c.h> #define ...
ALGO
0.993029
3.85093
3f06961e-d627-4220-a1cc-9cefe6699549
KhronosGroup/LLVM-SPIRV-Backend
llvm/lib/CodeGen/CalcSpillWeights.cpp
#include "llvm/CodeGen/CalcSpillWeights.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/CodeGen/LiveInterval.h" #include "llvm/CodeGen/LiveIntervals.h" #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineInstr.h" #include "llvm/CodeGen/MachineLoopInfo.h" #include "llvm/CodeGen/MachineOperand.h" ...
ALGO
0.980566
7.702327
bc16ead9-a848-4755-b3f3-840f708dff07
kazunetakahashi/atcoder
2018/0805_ABC104/D.cpp
/** * File : D.cpp * Author : Kazune Takahashi * Created : 2018-8-5 21:32:38 * Powered by Visual Studio Code */ #include <iostream> #include <iomanip> // << fixed << setprecision(xxx) #include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ; #include <vector> #include <string> // to_string(nnn) ...
ALGO
0.999988
4.178373
412d8dbb-95f2-4c15-8a15-844264898fc3
Kgm21/AyED1
2.1/1.a.cpp
#include <iostream> using namespace std; int main(){ int n1= 45, n2= 34, suma = 0; suma = n1 + n2; cout << n1 << " + " << n2 << " = " << suma << endl; return 0; }
ALGO
0.998426
3.291847
c7a156d7-68be-459c-83b5-57128dc3e801
ljllili23/learngit
AlgorithmsC/::test-09-02.cpp
//test.cpp #include <stdio.h> typedef int DataType; void Reverse(DataType A[], int left, int right, int arraySize) { if(left>right || right>=arraySize) return; int mid = (left+right)/2; for(int i=0;i<=mid-left;i++) { DataType temp=A[left+i]; A[left+i]=A[right-i]; A[right-i]=temp; } } void Exchange(DataTyp...
ALGO
0.996433
3.920461
8d140a1a-3ef2-4358-85ee-9d9a61d9e5cb
nitnizzie/BOJ
src/11021/11021.cpp
#include <iostream> using namespace std; int main() { int T, A, B; cin >> T; for (int i = 1; i <= T; i++) { cin >> A >> B; printf("Case #%d: %d\n", i, A+B); } }
ALGO
0.994221
6.16178
2dc68655-1718-44bd-8647-5a90441c1b05
alexkats/Code
Contests/19.11.2013/C/C.cpp
#include <iostream> #include <fstream> #include <string> #include <cstring> #include <cmath> #include <cstdio> #include <cstdlib> #include <vector> #include <algorithm> #include <set> #include <map> #include <cassert> #include <ctime> #include <cctype> #include <stack> #include <queue> #include <deque> #include <utilit...
ALGO
0.999533
3.599427
90c6ea11-783c-495b-bc45-6a93b42c8f3c
ishandutta2007/codeforces
wiwiho/normal/1214/D.cpp
//#define NDEBUG #include <bits/stdc++.h> #define StarBurstStream ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define iter(a) a.begin(), a.end() #define riter(a) a.rbegin(), a.rend() #define lsort(a) sort(iter(a)) #define gsort(a) sort(riter(a)) #define mp(a, b) make_pair(a, b) #define pb(a) push_back(...
ALGO
0.999966
3.579901
134a0ab4-e302-43dc-a71e-8fa48a4470f2
stbrumme/leetcode
0657.cpp
class Solution { public: bool judgeCircle(string moves) { int x = 0, y = 0; for (auto m : moves) switch (m) { case 'U': y++; break; case 'D': y--; break; case 'R': x++; break; case 'L': x--; break; } ...
ALGO
0.999801
6.135831
319778f9-38b6-4974-acfe-40c49587e836
Zattox/Year-1_Module-4_HomeworkContests_Cplusplus
Week-1/n.cpp
#include <iostream> using std::cin, std::cout; int main() { int64_t a, b, ans = 0; cin >> a >> b; while (a * b > 0) { if (a > b) { ans += a / b; a -= (a / b) * b; } else if (b > a) { ans += b / a; b -= (b / a) * a; } else if (a == b) { a = 0; b = 0; ++ans; ...
ALGO
0.997686
4.734338
946b88ed-67dd-4ed3-84d6-84e4497d5463
Suvarnarajugera/OWLCODER
Medium/Combination Sum II/combination-sum-ii.cpp
//{ Driver Code Starts //Initial Template for C++ #include <bits/stdc++.h> using namespace std; // } Driver Code Ends //User function Template for C++ class Solution{ public: void solve(int ind ,vector<int>&v,int target,vector<int>& arr,int n,vector<vector<int>>&ans){ if(target == 0){ ans.pus...
ALGO
0.999842
5.647736
f1030994-5103-42b6-9230-aa97dcac104f
ADDY69O/LeetCode
0130-surrounded-regions/0130-surrounded-regions.cpp
class Solution { public: void dfs(vector<vector<char>> &board,int row,int col,vector<vector<bool>>& visited,int n,int m){ // visited[i][j]=1; // board[i][j]='O'; board[row][col]='#'; int drow[]={1,0,-1,0}; int dcol[]={0,1,0,-1}; for(int l=0;l<4;l++){ int n...
ALGO
0.99987
5.757023
9db30c08-e249-4ead-8399-619dd37ecc8b
aparame/Temporal_Logic_Guided_Robot_Navigation
breach-master/@STL_Formula/private/src/robusthom/robustness.cpp
#include "robustness.h" #include <list> #include "mex.h" using namespace std; /*---------------------------------------------------------------------------* * MAIN FUNCTIONS * *---------------------------------------------------------------------------*/ S...
ALGO
0.999859
5.59943
21e944d9-1b9b-47a4-9609-b547c96c10e0
lmh760008522/ProgrammingExercises
校程序设计比赛/2016_1e.cpp
#include<cstdio> int ans[100001]; void init(){ ans[0]=0; for(int i=1;i<100000;i++){ ans[i]=ans[i-1]^i; } } int main(){ int t; scanf("%d",&t); init(); while(t-- > 0){ int n; scanf("%d",&n); printf("%d\n",ans[n]); } return 0; }
ALGO
0.999777
4.016071
0e2ea524-2eba-495c-ab71-588fa19c606a
kottesh/lc
sliding_window/713. Subarray Product Less Than K.cpp
class Solution { public: // getting overflow error //int numSubarrayProductLessThanK(vector<int>& nums, int k) { // int count = 0; // for (int win = 1; win <= nums.size(); win++) { // int curr_win = win; // long long prod = 1; // for (int i = 0; i < curr_win; i++)...
ALGO
0.999915
5.112833
5b62de81-c8a2-44c4-aaa4-1b71f8cf88b5
aujasvit/competitive-programming
INOI/highway_bypass.cpp
//Problem Link: https://www.codechef.com/INOIPRAC/problems/INOI1401 #include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define mp make_pair int r, c, dodo; vector <int> a[310]; int dp[310][310][310][2]; int mod = 20011; int ans(int row, int col, int d = 0, bool can = true) { i...
ALGO
0.999608
4.12102
135489fa-9fe4-4cfd-bc6f-6b65d3865328
1998factorial/comp4128
math/fft_template.cpp
#include <iostream> #include <cstring> #include <algorithm> #include <vector> #include <cstdio> #include <cmath> #include <algorithm> using namespace std; /* 快速多项式相乘: 两点确定一条直线,于是n个不同的点确定一个n项式 利用原跟,wn在单位圆上n等分划分圆的性质,结合 二分思想,在nlogn时间内将每一个F(wn ^ k)算出, 这个步骤称为DFT。 然后由于A(x) * B(x) = C(x),可以通过点值相乘 反推系数从而解出C,由神奇矩阵发现元素为之前矩阵的 倒数,...
ALGO
0.999983
3.79909
62bbd2a7-d259-4a3f-aa59-17df2289329f
Linvoker/leetcode
15.cpp
//利用两个指针完成扫描,利用2sum的思想借用hashmap解决,但这是错误的 /* class Solution { public: vector<vector<int>> threeSum(vector<int>& nums) { if (nums.empty()) { return vector<vector<int>>(); } vector<vector<int>> ret_vec; unordered_map<int, int> m_int_int; std::sort(nums.begin(), nums...
ALGO
0.999978
5.157181
1388968d-03ed-4498-9b2f-b9be06ad35de
NVlabs/data-orchestration
loop-nests/bellman-ford/reference/bellman-ford-reference.cpp
#include <limits> #include "whoop.hpp" #include "bellman-ford.hpp" //Bellman-Ford algorithm w/o negative cycle check int main(int argc, char** argv) { using namespace whoop; static const int starting_node = 0; TensorIn connections("connections"); VecOut distances("distances"); whoop::Init(argc, argv...
ALGO
0.998548
4.985462
f9268b55-fb51-42f2-b777-671247ae681c
shreyaschavhan/100-days-of-code
Day 081 - 21st December 2020/Lecture 002/2.4-loops.cpp/program-to-add-only-positive-numbers.cpp
#include <bits/stdc++.h> using namespace std; int main(){ int num; int sum = 0; cin >> num; while(num >= 0){ sum += num; cin >> num; } cout << sum; return 0; }
ALGO
0.999624
3.673918
0e812fe4-44f7-44f0-ac7c-da5cba660662
Anshuman-Computer-Curiosity/Chap-4---Arrays-and-Strings
insertion.cpp
#include <iostream> using namespace std; // Function to insert an element into an array // void insertElement(int arr[], int &size, int element, int pos) { void insertSort(int arr[], int &size, int element) { // Check if the pos is valid // if (pos < 0 || pos > size) { // cout << "Invalid position for...
ALGO
0.999949
5.737655
630c7092-fc1a-4d1f-a203-1efe885e42b0
RadonX/Computer-Animation
Theme1Milestone2/FOSSSim/SimpleGravityForce.cpp
#include "SimpleGravityForce.h" SimpleGravityForce::SimpleGravityForce( const Vector2s& gravity ) : Force() , m_gravity(gravity) { assert( (m_gravity.array()==m_gravity.array()).all() ); assert( (m_gravity.array()!=std::numeric_limits<scalar>::infinity()).all() ); } SimpleGravityForce::~SimpleGravityForce() {} v...
ALGO
0.914985
6.008826
4abdd18d-7f56-41bd-915c-78609d239d60
CS126SP20/final-project-ohbrandon0414
src/engine.cpp
// // Created by ohbra on 4/21/2020. // #include "engine.h" #include "Board.h" #include <algorithm> #include <Location.h> engine::engine(Board* input_board) { board = input_board; world = board->GetWorld(); current_rock = nullptr; is_launched = false; is_red_turn = true; is_y_point_selected = false; num...
TOOL
0.915633
5.373819
bf3b59fe-9ddd-4339-b9dc-006b935ce912
vsricharan16/cp
practise/477b.cpp
/*I shall rise*/ #include<bits/stdc++.h> using namespace std; #define rep(i,n) f(i,0,n) #define charan int main() #define vi vector< int > #define vl vector< ll > #define vii vector<pii> #define vll vector<pll> #define viii vector<tri> #define tri pair<int,pii> #define mod (1000*1000*1000+7) #define moddd (1000*1000*10...
ALGO
0.999871
3.659187
4b64ba2f-3712-4611-bf54-b3ea8d43c28f
kingkong2004/LEDUCMANH_MONC
Chuong 2/Program_2.22.cpp
#include <iostream> using namespace std; int main() { // Bi?n ?? l?u l??ng l??ng hng thng v s? ti?n ?ng gp. double monthlyPay = 6000.0, contribution; // Tnh v hi?n th? s? ti?n ?ng gp 5%. contribution = monthlyPay * 0.05; cout << "5 percent is $" << contribution << " per month.\n"; // Tnh v hi...
ALGO
0.968355
3.522106
2dada9db-995b-46c0-92bb-300cb8e1e919
SnoopyCodes/code
silver/grind/att2/fail/test/cowfrisbee/cowfrisbee.cpp
#include <bits/stdc++.h> #define ll long long using namespace std; vector<pair<int, int>> cows; vector<int> taller; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; cows.resize(N); taller.resize(N); for (int i = 0; i < N; i++) { cin >> cows[i].first; ...
ALGO
0.999891
3.972407
25f05f47-33dc-4e2b-819f-878700b1777b
sanhaa/Coding
ps/Jungol/J_2460(나는학급회장이다).cpp
/* 2021-04-22 J 1078 */ #include <iostream> using namespace std; int MAX(int a, int b, int c) { if (a > b) { if (c > a) { return c; } else if(c < a){ return a; } else return -2; } else if(a < b) { // a < b if (b > c) { return b; } else if( b < c) { return c; } else return -3; } el...
ALGO
0.99993
4.493651
b150fa1a-5b0d-4c98-8747-9eabd9b504b7
ReciHub/FunnyAlgorithms
Matrix Chain Multiplication/MatrixchainMultiplication.cpp
/* A naive recursive implementation that simply follows the above optimal substructure property */ #include<bits/stdc++.h> using namespace std; // Matrix Ai has dimension p[i-1] x p[i] // for i = 1..n int MatrixChainOrder(int p[], int i, int j) { if(i == j) return 0; int k; int min = INT_MAX; int coun...
ALGO
0.999997
5.127909
6012b5cf-56cc-4ca3-8acc-185c1a6776f1
insubkim/Problem_Solving
Programmers/Lv2/이진 변환 반복하기.cpp
#include <string> #include <vector> #include <algorithm> #include <bitset> using namespace std; int deleteZero(string &s) { size_t zeroCount = count(s.begin(), s.end(), '0'); s.erase(remove(s.begin(), s.end(), '0'), s.end()); return zeroCount; } void binaryRepresentation(string& s) { s = std::bitset<64>(s.s...
ALGO
0.999833
4.80057
6310ef6a-b56d-424f-8461-07961fc57d1e
SetsunaChyan/OI_source_code
2019 Xuzhou Online/G.cpp
#include<bits/stdc++.h> using namespace std; typedef long long ll; string rem,s; const int MAXN=700005; int pos=0,maxright=0,maxlen=0,r[700005],last[26]; ll ans; ll IT[MAXN<<2],add[MAXN<<2]; int n,q; void mlc() { for(int i=0;i<rem.length();i++) s+='#',s+=rem[i]; s+='#'; for(int i=0;i<s.length();i+...
ALGO
0.999948
3.83074
01760be8-473c-4789-9cfd-83821b950589
mmmhj2/code-competitive
SGU/172/12654228_WA_0ms_0kB.cpp
#include <iostream> #include <cstring> #include <vector> #include <queue> using namespace std; const int MAXN = 200; const int MAXM = 30000; int N, M; int Adj[MAXN+5][MAXN+5]; int bicolor[MAXN+5]; bool flag = true; int main() { memset(bicolor, 0xff, sizeof bicolor); cin >> N >> M; for(int i = 1; i <= M; i...
ALGO
0.999977
4.249892
0de7a92f-bbc5-4c40-af9d-e6cb2a3e08f1
maxkimlyk/cpp-demo
boost/boost-geometry.cpp
#include <boost/geometry.hpp> #include "demo-common.h" #include <boost/geometry/geometries/adapted/boost_tuple.hpp> BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian) using namespace boost::geometry; DEMO(point) { model::d2::point_xy<double> p1(1, 1), p2(0.5, 0.5); std::cout << "Distance p1-p2: " << boos...
ALGO
0.980173
7.034384
4c3fb85d-3aee-4287-b051-cdc443ad9d72
ishandutta2007/codeforces
akim/normal/645/C.cpp
#include <algorithm> #include <iostream> #include <sstream> #include <utility> #include <cstdlib> #include <cstring> #include <cassert> #include <fstream> #include <cstdio> #include <string> #include <vector> #include <queue> #include <cmath> #include <ctime> #include <stack> #include <map> #include <set> using namesp...
ALGO
0.999967
4.022949
3ed3cdaa-f448-4916-897d-aee1f1494733
tojatos/SPOJ
JPESEL.cpp
#include <iostream> using namespace std; bool is_valid_pesel(char*); int main() { int t; cin >> t; /* wczytaj liczbę testów */ char** pesels = new char*[t]; for (int i = 0; i < t; i++) { char* pesel = new char[11]; cin >> pesel; pesels[i] = pesel; } for (int i = 0; i < t; i++) { if(is_va...
ALGO
0.999201
5.333114
200520ae-7624-444e-8664-9b70c7bb25aa
MiraclePallavi/cses
stickLength.cpp
#include <bits/stdc++.h> using namespace std; int main(){ long long n; cin>>n; vector<long long>v(n); for(int i=0;i<n;i++){ cin>>v[i]; } sort(v.begin(), v.end()); long long mid = v[n/2]; long long ans = 0; for(int i=0;i<n;i++){ ans+=abs(v[i]-mid); } cout<<ans...
ALGO
0.999941
4.5864
85e9329c-2185-4618-8b46-23410c5d35eb
ankan-ekansh/Competitive-Programming
Kickstart_2020_Round_D/Bv3.cpp
/* Stay motivated and keep working hard */ #include<bits/stdc++.h> #define ll long long using namespace std; ll a[100007]; ll dp[100007][4]; int main(){ #ifndef ONLINE_JUDGE freopen("input.txt", "rt", stdin); // freopen("output.txt", "wt", stdout); #endif ios_base::sync_with_stdio(false)...
ALGO
0.999243
4.079701
3a52f977-c33c-4309-8f84-81ddc4018fe2
swolecoder/LeetCodeEveryDay
0205-isomorphic-strings/0205-isomorphic-strings.cpp
class Solution { public: bool isIsomorphic(string s, string t) { std::unordered_map<char,char> s_map,t_map; if(s.length() != t.length()){ return false; } for(int i =0; i < s.length(); i++){ if(s_map.find(s[i]) != s_map.end()){ if(s_map[s[i]]...
ALGO
0.999967
6.197316
042c0462-f06b-4011-84cc-871be224a254
m4oughi/100DaysofCode
pureCPP/0053. Day 53/constexpr & consteval/021. constexpr and consteval for Optimization/008. constexpr for Optimized Matrix Computations/main.cpp
#include <iostream> #include <array> constexpr std::array<std::array<int, 2>, 2> multiplyMatrix( const std::array<std::array<int, 2>, 2>& a, const std::array<std::array<int, 2>, 2>& b) { return {{ { a[0][0] * b[0][0] + a[0][1] * b[1][0], a[0][0] * b[0][1] + a[0][1] * b[1][1] }, { a[1][0] *...
ALGO
0.999715
5.168495
efec4623-c8aa-4ae6-85b4-0e258c6debdc
DBoss007/YSZSever
Server/library/eigen/bench/benchmarkX.cpp
// g++ -fopenmp -I .. -O3 -DNDEBUG -finline-limit=1000 benchmarkX.cpp -o b && time ./b #include <iostream> #include <Eigen/Core> using namespace std; using namespace Eigen; #ifndef MATTYPE #define MATTYPE MatrixXLd #endif #ifndef MATSIZE #define MATSIZE 400 #endif #ifndef REPEAT #define REPEAT 100 #endif int mai...
ALGO
0.910289
3.370773
42eed8a4-d275-4158-92b7-cc2c1fc85c11
gunzigun/STLOriginCodePractic
第3章/find.cpp
#include <vector> #include <list> #include <deque> #include <algorithm> #include <iostream> using namespace std; int main() { const int arraySize = 7; int ia[arraySize] = {0,1,2,3,4,5,6}; vector<int> ivect(ia, ia+arraySize); list<int> ilist(ia, ia+arraySize); deque<int> ideque(ia, ia+arraySize); ...
TOOL
0.99172
3.856513
641ca6ce-9a61-46bf-83c7-9cea0cfab246
Fly0307/dtee_ncnn_face_recognition
src/host/secure/secure_include/ncnn.x64/layer/x86/sigmoid_x86_avx.cpp
#include "sigmoid_x86_avx.h" #if __SSE2__ #include <emmintrin.h> #include "sse_mathfun.h" #if __AVX__ #include <immintrin.h> #include "avx_mathfun.h" #if __AVX512F__ #include "avx512_mathfun.h" #endif // __AVX512F__ #endif // __AVX__ #endif // __SSE2__ namespace ncnn { Sigmoid_x86_avx::Sigmoid_x86_avx() { #if __SSE2...
ALGO
0.983908
6.301013
cea63908-0acc-492a-8450-2e67a9fcbc0f
Dreams-Lp-Old/platform_frameworks_av
media/libstagefright/codecs/amrnb/dec/src/wmf_to_ets.cpp
/* ------------------------------------------------------------------------------ Pathname: ./audio/gsm-amr/c/src/wmf_to_ets.c Funtions: wmf_to_ets Date: 01/21/2002 ------------------------------------------------------------------------------ REVISION HISTORY Description: Changing mode to frame_type_3gpp ...
ALGO
0.979407
6.727635
ac2b0530-fe69-45ab-a2c8-b3ef522cc878
liminchen/OptCuts
ext/libigl/include/igl/faces_first.cpp
#include <vector> #include <Eigen/Dense> template <typename MatV, typename MatF, typename VecI> IGL_INLINE void igl::faces_first( const MatV & V, const MatF & F, MatV & RV, MatF & RF, VecI & IM) { assert(&V != &RV); assert(&F != &RF); using namespace std; using namespace Eigen; vector<bool> in_...
ALGO
0.999365
5.283256
ecfe0ac5-0c57-4053-9bda-21f398de4b05
DandyYahmin/Algorithms
4-times-fibonacci.cpp
/* Case from CodeWars: You`re will be given length of fibonacci. Could you give the sum of 4*(perimeter) The function perimeter has for parameter n where n + 1 (they are numbered from 0 to n) and returns the total perimeter. Hint: - See Fibonacci sequence - Fibonacci(5) => 4 * (1 ...
ALGO
0.999535
4.517442
cb6b2f98-94f8-4330-a381-eee4b776d34a
forkkit/krita
libs/image/kis_green_coordinates_math.cpp
#include "kis_green_coordinates_math.h" #include <cmath> #include <kis_global.h> #include <kis_algebra_2d.h> using namespace KisAlgebra2D; /** * Implementation of the Green Coordinates transformation method * by Yaron Lipman, David Levin, Daniel Cohen-Or * * http://www.math.tau.ac.il/~lipmanya/GC/gc.htm */ stru...
ALGO
0.962108
6.281332
c4faeaef-dd40-4682-9273-681af58c41a8
HimanshT/cc-codes
matrix/47.cpp
// You don't need to read input or print anything. Your task is to complete the function rowWithMax1s() which takes the array of booleans arr[][], n and m as input parameters and returns the 0-based index of the first row that has the most number of 1s. If no such row exists, return -1. // instead of traversal we coul...
ALGO
0.999954
5.577429
1746c458-94e3-45fb-bae1-53ee0be21956
lonelyhentxi/workspace
cpp/emcpp/impls/trim.cpp
#include <vector> #include <string> #include <iostream> int main() { /** * 针对可复制的形参,在移动成本低且一定会被复制的情况下,考虑将其按值传递 */ { // 1 仅对于可复制的形参,才考虑按值传递; // 2 按值传递仅仅在形参成本低廉的情况下; // 3 在不需要重新分配内存的情况下,按值传递会导致多得多的成本; // 4 在调用链上传递累加会导致难以忍受的成本; // 5 按值传递可能遇到切片问题; } /** ...
TOOL
0.985196
6.125952
f33be1ca-d8da-42f9-aff4-b6f538b5012c
bollu/llama.lean
llama.cpp/examples/simple-refactor/main.cpp
// Defines sigaction on msys: #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include "common.h" #include "llama.h" #include <cassert> #include <cinttypes> #include <cmath> #include <cstdio> #include <cstring> #include <fstream> #include <iostream> #include <string> #include <vector> #if defined (__unix__) || (defin...
TOOL
0.867811
6.523076
a51afb8a-f27d-443b-a5c5-1dd34ff2c99a
abdulwarisgurkhoo/OPERATIONS_ON_ARRAY
to_find_sum_of_pair_in_unsorted_array.cpp
/****************************to_find_sum_of_pair_in_unsorted_array************************/ #include<iostream> using namespace std; void sum(int arr[],int count,int num) { for (int i = 0; i < count; i++) { for (int j = i+1; j < count; j++) { if(arr[i]+arr[j]==num) { ...
ALGO
0.999602
4.814852
1a2ab727-e7f1-4733-a10d-6522433e2448
rishab1128/LeetCode-Problems
241-different-ways-to-add-parentheses/241-different-ways-to-add-parentheses.cpp
class Solution { public: vector<int> recur(string expr) { int n = expr.size(); int i; char op='#'; vector<int>res; for(i=0; i<n; i++) { if(expr[i]=='*' || expr[i]=='+' || expr[i]=='-'){ op=expr[i]; string s...
ALGO
0.999946
5.184278
35d6bb46-d779-4a7b-9d89-628f43c1d79a
BunanSia/c_practice
stack-basic.cpp
#include<stdio.h> #define CAPACITY 5 int isFull(int t){ if (t==CAPACITY-1) return 0; else return 1; } int isEmpty(int t){ if(t==-1) return 0; else return 1; } int push(int t){ if(isFull(t)){ return 1; } else scanf("%d",&temp); t++; } int pop(int t){ if(isEmpty(t)){ return 1; } else t--; } int ...
ALGO
0.997769
3.237516
5a2ce0a5-5775-484e-860d-3329e05f5f1b
aoaforever/C_trian
Leetcode/sort/quick_sort.cpp
#include <vector> #include <iostream> using namespace std; /* 快速排序:属于交换排序,根据序列中两个元素关键字的比较结果来对换这两个记录在序列中的位置。 */ void quick_sort(vector<int>&nums, int l, int r){ if (l+1 >= r){ return ; } int first =l, last = r-1, key = nums[first]; while(first<last){ while(first<last && nums[last]>=key )...
ALGO
0.999977
4.753345
3cdc1e92-b5df-44dd-bb79-6f471132d4ef
rayyanabubakr/Sorting-techniques
Pivot In Sorted And Rotated Array.cpp
// 1. You are given an array(arr) of distinct integers, which is sorted and rotated around an unknown point. // 2. You have to find the smallest element in O(logN) time-complexity #include<iostream> #include <bits/stdc++.h> using namespace std; int findPivot(int arr[], int n) { int lo = 0; int hi = n - 1; whil...
ALGO
0.999986
5.314413
69896030-eaa4-4d9b-afc5-644efe00f93f
KINGDRAGONER/CSE-165
Lab 1/Code/Fillvector.cpp
#include <iostream> #include <fstream> #include <string> #include <vector> using namespace std; void Normal() { vector<string> v; ifstream in("code.cpp"); string line; while (getline(in, line)) // getline returns true if read successfully v.push_back(line); // add the line to the end of v for (int i = 0; i ...
TOOL
0.954179
3.473709
702f6df3-9d1a-4364-8c86-f0583899cce8
alanqchen/toonify-cpp
src/mergesort.cpp
/* * mergesort.cpp * * Performs merge sort based on the intensity of the pixels * Used by median blur(median.cpp). */ #include <stdlib.h> #include <stdio.h> #include <math.h> #include <iostream> #include "mergesort.h" #include "median.h" using namespace std; int merge(grayPixel_t A, int lo1, int hi1, int lo2, ...
ALGO
0.999869
5.276981
10b339ea-4ffa-447c-b7b7-df3edccb4079
Hoangnhat-us/CS163-OurProject
src/SuffixArray.cpp
#include <algorithm> #include <cassert> #include <codecvt> #include <locale> #include "SuffixArray.h" std::ifstream in; std::ofstream out; SuffixArray::SuffixArray(initType iType, dictType dType) { if (iType == Cur) { if (dType == EE) { std::string filename = "Data_Storage/Eng2Eng/Current/eng2eng.txt"; ...
TOOL
0.971729
4.307386
98cb6582-5f9b-4f47-80cd-a128044712ad
Ashleshk/Programming-Codes
C Programs/NPTEL Programs/Char.cpp
#include<iostream> using namespace std; int checkprime(int n) { int i; if(n == 1 || n == 0) return 0; for(i=2; i*i<=n; i++) { if(n % i == 0) return 0; } return 1; } int main() { int t; cin>>t; while(t--) { int m, n; cin>>m>>n; int i; for(i=m; i<=n; i++) { int k; k = checkprime(i); if(k...
ALGO
0.999908
4.174682
8242a945-c6aa-416b-89e7-bdc1b1b61538
2SSK/leetcode
Leetcode/two_pointers/push_dominoes/main.cpp
// ================================== // You will input in the input.txt file // Output will be printed in output.txt file // ================================== #include <bits/stdc++.h> using namespace std; class Solution { public: string pushDominoes(string dominoes); }; int main() { // Speed up input/output ...
ALGO
0.999985
5.570599
78c764d4-e5cc-49b0-bb05-8f17956a1cbb
ltc-mweb/litecoin
src/test/util/blockfilter.cpp
#include <test/util/blockfilter.h> #include <chainparams.h> #include <validation.h> bool ComputeFilter(BlockFilterType filter_type, const CBlockIndex* block_index, BlockFilter& filter) { CBlock block; if (!ReadBlockFromDisk(block, block_index->GetBlockPos(), Params().GetConsensus())) { return false; ...
TOOL
0.892157
6.742158
3696b245-5467-4420-8e28-725ab575d393
weenchvd/Programming_Principles_And_Practice_Using_CXX
Chapter_21/C21_Exercise_21.13.cpp
/* Exercise 21.13 */ #include<iostream> #include<istream> #include<fstream> #include<sstream> #include<iomanip> #include<string> #include<vector> #include<cctype> #include<algorithm> #include"C21_Exercise_21.13.h" using namespace std; inline void error(string s) { throw runtime_error(s); } inline void error(const st...
TOOL
0.908729
6.330676
69b54c15-651f-40df-87ed-13d6158c3b4a
YisakH/Ps
1436/소스.cpp
#include <cstdio> bool check(int num) { int cnt = 0; while (num > 0) { if (num % 10 == 6) cnt++; else cnt = 0; if (cnt == 3) return true; num /= 10; } return false; } int main() { int N, cnt = 0, num = 666; scanf("%d", &N); while (cnt < N) { if (check(num++)) cnt++; } num--; printf...
ALGO
0.999417
3.914996
991b8c16-1a91-4b80-a29c-b4f1dc4d0a62
ImportLove/LeetCode-Practice
Q704.cpp
// 704. Binary Search (Easy) #include <iostream> using namespace std; class Solution { public: int search(vector<int>& nums, int target) { int begin = 0; int end = int(nums.size()); int mid; while (begin < end){ mid = (end-begin)/2 + begin; if (nums[mid] < t...
ALGO
0.999973
6.041197
74c8bf6b-2289-4695-a7b2-33c957276ddd
keyclehhh/MyFirstProject
tree/main.cpp
#include "tree.h" int main() { Letter i; BiTree pnew;//指向新节点的指针 BiTree tree=NULL;//树根 assist qhead=NULL ,qtail=NULL,pcur=NULL,listpnew=NULL; while(scanf("%c",&i)) { if(i =='\n') { break; } pnew=(BiTree) calloc(1,sizeof (BiTuNode)); pnew->data=...
ALGO
0.999174
3.375002
4aa21abb-5a47-4ba3-a1a1-acb1a225f805
Ishita-mukherjee/Data-Structures
Data Structures/Searching/Linear_seaching.cpp
#include<iostream> using namespace std; void LinearSearch(int a[],int n, int k) { int i,flag=0; for(i=0;i<n;i++) { if(a[i]==k) { flag=1; cout<<"Element found at: "<<i; break; } } if(flag==0) cout<<"Element not found"; } int main()...
ALGO
0.999049
4.713099
85321239-0d58-4680-9a97-026f14a47283
NguyenHongSang-16042004/Mon_C
chapter 11/chapter 11/challeges11.cpp/Challenges_11 (5).cpp
#include <iostream> #include <string> #include <limits> using namespace std; // Structure to store weather data for a month struct MonthData { double totalRainfall; double highTemperature; double lowTemperature; double averageTemperature; }; int main() { const int numMonths = 12; MonthData yea...
TOOL
0.998501
6.3356
d2fedb30-fe28-4596-975d-9773d4e348c4
fegounna/Competitive-Programming
France-IOI/Level4/Graphes/Chercher_les_zones_utilisables_de_la_forêt.cpp
#include <iostream> using namespace std; int n,a; bool tab[1001][1001]; bool sommet[1001]; int func(int x){ if(sommet[x]) return 0; sommet[x]=true; int s=1; for(int j=1;j<=n;++j){ if(tab[x][j]&&!sommet[j]){ s= s+ func(j); } } return s; } int main(){ cin>>n>...
ALGO
0.999606
3.44467
96d8ed10-bd05-4c95-8596-ac97590beaf2
besmabakirci1/OstimTechAlgo
1.Hafta/studentSolutions/ibrahimBayar/Question_8.cpp
// Verilen bir dizide yinelenen (duplicate) elemanları bulun #include <vector> // Marks the index locations of the values in input array. Exp: [1, 1, 2, 3] ----> [1, 1, 0, 0] std::vector<bool> FlagRepeatedElements(std::vector<int> input) { std::vector<bool> isDuplicate( input.size(), false ); // We assume there is ...
ALGO
0.998817
4.969606
39681511-417b-4f78-bd15-8df125d9463a
lydrainbowcat/tedukuri
配套光盘/习题/0x6B 图论 总结与练习/Cashier Employment/POJ1275.cpp
/* Author: wccy ο */ #include <cstdio> #include <cstring> #include <iostream> #include <cstdlib> using namespace std; const int Mn = 3000, Me = 100000 + 10; int hd[Mn],nxt[Me],to[Me],w[Me],cnt; int dis[Mn],que[100000],tot[Mn]; bool vis[Mn]; int r[Mn],num[Mn],n; inline void add(int x, int y, int z) { to[cnt] = ...
ALGO
0.999989
3.256711
e3496e42-f016-4a9f-b80e-cf57089b3aa9
BenJacobson/JaneStreetPuzzles
May2024/solve.cpp
#include <fstream> #include <functional> #include <iostream> #include <set> #include <string> #include <vector> typedef long long ll; typedef std::function<bool(ll)> Validator; const ll N = 11; const ll SHADED = -999; const ll UNSET = -1; ll boxes[N][N]; ll state[N][N]; // std::vector<int> row_order = {7, 8, 9, 10, ...
ALGO
0.999922
5.053284
3836cff6-a83d-4322-b69b-76a1af1cdeaa
RishabhKumar25/DSA-Practice-Series
Pattern Questions/pattern13.cpp
#include<iostream> using namespace std; int main(){ /* A B C B C D C D E */ int n; cin>>n; for(int i =1;i<=n;i++){ for(int j=1;j<=n;j++){ char ascii = 'A'+i+j-2; cout<<ascii<<" "; } cout<<endl; } }
ALGO
0.99866
3.492283
c48796fc-4121-40e6-a3c9-79bdd0211fdc
massivethreads/tp-parsec
pkgs/apps/ferret/src/benchmark/ferret-tbb.cpp
#include <stdio.h> #include <math.h> #include <sys/types.h> #include <sys/stat.h> #include <dirent.h> #include <unistd.h> #include <pthread.h> #include "../include/cass.h" #include "../include/cass_timer.h" #include "../image/image.h" #include "ferret-tbb.h" #ifdef ENABLE_PARSEC_HOOKS #include <hooks.h> #endif #defin...
DATA
0.96148
4.036183
c3cf7ca3-3682-4d13-878d-361d7d38fe00
Anh-duc0754/workspace-
code c++/bai vl 11.cpp
// Bi 11: Tnh S(n) = 1 + 1.2 + 1.2.3 + + 1.2.3.N #include<iostream> #include<math.h> using namespace std; int main() { int n; cout << " nhap n: "; cin >> n; int s = 0; int p = 1; for ( int i =1 ; i <= n; i++){ p *= i; // bien p de lua phep giai thua cua i ; vd n = 2 p = 2*1 =2 ; gn 2 cho p ; n = 3 p = p ...
ALGO
0.999954
3.835959
a7ba5611-b966-4225-8fec-e9a4e7d592e9
f-tischler/ParallelSystems
Exercise7/test/test_jacobi_3d.cpp
#include "../stencil.h" #include "../jacobi.h" #include "../iteration.h" int main(int, char*[]) { using namespace stencil; using jacobi_3 = jacobi<3>; using iteration = iteration<3>; constexpr ::bounds_t<3> bounds = { 7, 7, 7, 7, 7, 7 }; constexpr grid_extents_t<3> extents = { 3, 3, 3 }; ...
ALGO
0.879532
4.530344
6dfbb754-15d1-48c7-af26-6018a21fb9e5
emanuelwp/StorageApp
windows/runner/utils.cpp
#include "utils.h" #include <flutter_windows.h> #include <io.h> #include <stdio.h> #include <windows.h> #include <iostream> void CreateAndAttachConsole() { if (::AllocConsole()) { FILE *unused; if (freopen_s(&unused, "CONOUT$", "w", stdout)) { _dup2(_fileno(stdout), 1); } if (freopen_s(&unuse...
TOOL
0.998733
6.76775
ee409328-8603-4ee9-ae40-cc269406da07
rebecacalazans/Competitive-Programming
provas/codeforces_101072/b.cpp
#include <bits/stdc++.h> using namespace std; #define st first #define nd second #define mp make_pair #define pb push_back #define cl(x, y) memset(x, y, sizeof(x)) #define db(x) cerr << #x << " == " << x << endl #define dbs(x) cerr << x << endl #define _ << ", " << typedef long long ll; typedef long double ld; type...
ALGO
0.999955
3.33839
27b87fb1-d5f2-4e74-9c47-b78821441de8
ishandutta2007/codeforces
vercingetorix/normal/22/A.cpp
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <ctype.h> #include <deque> #include <cstring> #include <set> #include <bitset> #include <map> #include <chrono> #include <random> #include <unordered_map> #include <stdio.h> using namespace std; typedef long long ll; typedef long do...
ALGO
0.999971
3.778691
caef34b5-0cfd-4f9c-b238-551f7c9c5d69
Sowmik23/CompetitiveProgramming
GeeksforGeeks/pow(x,y).cpp
//This program calculates pow(x, y) in O(logn) time /* Extended version of power function that can work for float x and negative y*/ #include <bits/stdc++.h> using namespace std; float power(float x, int y) { float temp; if(y == 0) return 1; temp = power(x, y / 2); if (y % 2 == 0) return temp * temp...
ALGO
0.999663
5.553466
0056849b-7298-4140-820b-23b6c001a88a
udacity/nd013-c5-planning-starter
project/starter_files/eigen-3.3.7/doc/examples/function_taking_ref.cpp
#include <iostream> #include <Eigen/SVD> using namespace Eigen; using namespace std; float inv_cond(const Ref<const MatrixXf>& a) { const VectorXf sing_vals = a.jacobiSvd().singularValues(); return sing_vals(sing_vals.size()-1) / sing_vals(0); } int main() { Matrix4f m = Matrix4f::Random(); cout << "matrix m:...
ALGO
0.999871
5.283265
f2206983-d340-44bc-82c5-139562ae849f
juanestebancg2806/uvaProblems
uva216/uva216.cpp
#include <iostream> #include <string> #include <vector> #include <stdlib.h> #include <stdio.h> #include <math.h> #include <string.h> #define INF 999999999.0 #define ms(a,b) memset(a,b,sizeof(a)) using namespace std; int N; vector<int> path; vector<int> pathtmp; vector<int> x; vector<int> y; double G[9][9]; double ans; ...
ALGO
0.999424
3.730922
d0317497-c961-4e51-89ac-6c0007d53bca
omarmorle/codeforces
1096A.cpp
#include<bits/stdc++.h> using namespace std; int main (void) { int T, l, r, i; cin>>T; while(T--) { cin>>l>>r; cout<<l<<" "<<l+l<<endl; } return 0; }
ALGO
0.995578
3.623109
1895b578-a952-490f-8cb5-2619d95ad0e8
ashishkushwaha56/LeetCode-Leethub
0912-sort-an-array/0912-sort-an-array.cpp
class Solution { public: vector<int> sortArray(vector<int>& nums) { vector<int> a = nums; sort(a.begin(),a.end()); return a; } };
ALGO
0.999946
5.731141
98c96070-3e4b-4c1b-a26a-5b565b548b25
ishandutta2007/codeforces
shatovoleg/normal/1574/B.cpp
#include "bits/stdc++.h" using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; typedef long double ld; #define all(v) v.begin(), v.end() #define len(v) ((int)(v).size()) #define pb push_back #define kek pop_back #define pii pair<int, int> #define pll pair<ll, ll> #defi...
ALGO
0.999935
3.838728
858587ad-be78-4c1c-8d26-2888248947b5
sarvex/leetcode-hack
solution/0800-0899/0854.K-Similar Strings/Solution.cpp
class Solution { public: int kSimilarity(string s1, string s2) { queue<string> q{{s1}}; unordered_set<string> vis{{s1}}; int ans = 0; while (1) { for (int i = q.size(); i; --i) { auto s = q.front(); q.pop(); if (s == s2) { ...
ALGO
0.99999
5.839721
a6551eab-f409-4762-b46d-9483e2ef2631
Fico-As/EjerciciosCPP
ejercicio81.cpp
/*81)Dado un numero N psitivo mostrar la cantidad de digitos que son diferentes de ceros que contiene. Ej.: */ #include<iostream> #include<math.h> #include "funciones.h"// cargo mi propia libreria con funciones comunes using namespace std; int diferentesCero(int n){ int dig,c=0; while(n>0){ dig=n-((int...
ALGO
0.999018
3.343904
636628b3-16b2-4336-bd19-8ececa98b054
ddayzzz/algorithm-and-basic-apps
math/extend_gcd.cpp
// 扩展欧几里得定理的应用 // https://blog.csdn.net/zhjchengfeng5/article/details/7786595 // https://zh.wikipedia.org/wiki/%E6%89%A9%E5%B1%95%E6%AC%A7%E5%87%A0%E9%87%8C%E5%BE%97%E7%AE%97%E6%B3%95 #include <iostream> #include <cstdio> using namespace std; // int gcd(int a, int b) { // 辗转相除法求最大公约数 return b == 0 ? a : gcd(b, ...
ALGO
0.999917
3.745961
61978b73-f347-4590-bf89-41cff309829b
nipunid/VR-2022
windows/runner/utils.cpp
#include "utils.h" #include <flutter_windows.h> #include <io.h> #include <stdio.h> #include <windows.h> #include <iostream> void CreateAndAttachConsole() { if (::AllocConsole()) { FILE *unused; if (freopen_s(&unused, "CONOUT$", "w", stdout)) { _dup2(_fileno(stdout), 1); } if (freopen_s(&unuse...
TOOL
0.998859
6.785645
5485e444-6f0a-47dc-8458-966554d1838c
YuichiFujita/BumpMappingTest
00_ソースファイル/project002_calcTangent/rankingManager.cpp
//============================================================ // // LO}l[W[ [rankingManager.cpp] // AuthorFcE // //============================================================ //************************************************************ // CN[ht@C //************************************************************ #inclu...
TOOL
0.879513
3.809225
b69e9d8f-a893-4982-bef8-8d558939fddb
ishandutta2007/codeforces
poopi/normal/263/A.cpp
/* in the name of Allah */ #include <iostream> #include <algorithm> #include <string> #include <vector> #include <ctime> #include <set> using namespace std; #define int64 long long #define P pair<int, int> int n, cnt; set <char> st; int gcd(int a, int b){ return (b == 0 ? a : gcd(b, a...
ALGO
0.999336
3.202849
c8164c88-75d2-4197-b6c3-441ead82bdf3
ComputerProgrammerStorager/DataStructureAlgorithm
CLRS/Math/ValidBoomerang.cpp
/* Given an array points where points[i] = [xi, yi] represents a point on the X-Y plane, return true if these points are a boomerang. A boomerang is a set of three points that are all distinct and not in a straight line. Example 1: Input: points = [[1,1],[2,3],[3,2]] Output: true Example 2: Input: points = [[1,1],[...
ALGO
0.999761
6.158984
c3e38def-23ab-428a-ad8b-31b0847a9471
xd43D41U5x/Scripts
randXor/randXorDecrypt.cpp
#include <iostream> #include <sstream> #include <cstdlib> #include <time.h> #include <Windows.h> #include <fstream> #include <vector> int main() { int secondXor = 0; std::string fileName; std::cout << "What is the name of the file: "; std::cin >> fileName; std::ifstream file(fileName, std::ios::bi...
ALGO
0.982843
4.453917
26781311-d844-483b-b882-a9e66724b3d2
Taejin1221/Re-PS
Baekjoon/Baekjoon26265.cpp
// Baekjoon26265.cpp #include <iostream> #include <string> #include <algorithm> using namespace std; using pss = pair<string, string>; bool compare(pss& a, pss& b) { if (a.first == b.first) return a.second > b.second; else return a.first < b.first; } int main(void) { ios_base::sync_with...
ALGO
0.999833
4.698454
ac9c50ea-79cd-4963-aa6d-9cc804c35a28
ChinaChenp/Source-Code
Cpp/crypt/sha1/Sha1.cpp
/* Contributors: Gustav Several members in the gamedev.se forum. Gregory Petrosyan */ #include "Sha1.h" namespace sha1 { namespace detail { // Rotate an integer value to left. inline unsigned int rol(const unsigned int value, const unsigned int steps) { return ((value << steps) | (val...
ALGO
0.999576
6.636566
2a0489d3-1854-4216-8221-10049a114bca
a6cenna/osninfor
usaco/bronze/greedy/cowtip.cpp
#include <bits/stdc++.h> using namespace std; vector<vector<bool>> cow; void flip(int row, int col) { for (int i = 0; i <= row; i++) { for (int j = 0; j <= col; j++) { cow[i][j] = !cow[i][j]; } } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); freopen("...
ALGO
0.99998
4.645624
23749b83-f3e1-4895-8ed2-2b0fcd705786
DeepeshnotCool/LeetCode-Submissions
my-folder/problems/can_make_arithmetic_progression_from_sequence/solution.cpp
class Solution { public: bool canMakeArithmeticProgression(vector<int>& arr) { sort(arr.begin(), arr.end()); int diff = arr[1]-arr[0]; for(int i = 2; i < arr.size(); i++) { if((arr[i] - arr[i-1]) != diff) return false; } return true; } ...
ALGO
0.999788
5.653386
8b8a0b20-cbf2-438f-a0df-804bebfe4884
atupal/oj
poj/3101_Astronomy_拓展欧几里得.cpp
#include <stdio.h> #include <stdlib.h> #include <string.h> unsigned long long p[3]; unsigned long long* gcdEx(unsigned long long a, unsigned long long b, unsigned long long *p) { if (b == 0) { p[0] = 1, p[1] = 0, p[2] = a; return p; } else { p = gcdEx(b, b%a, p); unsigned long ...
ALGO
0.99998
3.513924
76134e14-bbe5-435d-9227-956540eec1df
ZwieR-ZADROT/LitvinovC
Litvinov A C++/Пара 9 (Часть 1).cpp
#include <iostream> #include <cmath> #include <ctime> using namespace std; //begin() - начало массива //end() - конец массив //****************************************Заполнение массива рандомными элементами void zapolnenie(double a[], int n) //Принимаем массив и его длину { for (int i = 0; i < n; i++) { a[i] = r...
ALGO
0.925781
3.570226
af153e0d-0968-4de9-9268-101c23f4e007
schulzch/qml-ogdf
ogdfplugin/ogdf/src/ogdf/abacus/infeascon.cpp
/* * $Revision: 3386 $ * * last checkin: * $Author: gutwenger $ * $Date: 2013-04-10 14:00:02 +0200 (Mi, 10. Apr 2013) $ ***************************************************************/ #include <ogdf/abacus/infeascon.h> #include <ogdf/abacus/sub.h> namespace abacus { bool InfeasCon::goodVar(const Variable ...
ALGO
0.967192
6.054831
4f766276-6ae3-4350-93aa-fdca192b65fe
dasinlsb/Algorithm-Contest-Records
PersonalTraining/srm/512/1C.cpp
/* 原问题相当于给定一个单调不降的序列b,求有多少种序列a满足将其排序之后a_i<=b_i 如果考虑无序地填充要涉及状压无法接受,考虑有序地填入a_i 有个直接的dp是设状态f[i][j]表示前i个,最大不超过j f[i][j]=\sum_{S[k+1]>=j&&k<=i}f[k][j-1]*comb[i][k] 但是由于值域很大仍然无法接受 由于n很小,而且(a_i,a_{i+1}]这个区间里的所有数能填充的位置的限制是完全相同的 可以考虑用f[i][j]表示前i个,最大不超过(a_{j-1},a_j],转移只要在i-k个空位任意填充区间内的数即可 时间复杂度O(n^3) */ //#line 2 "PickAndDelete....
ALGO
0.999924
3.838398
9e59f95a-3324-432e-bb4e-7e9abdaa83c6
ishandutta2007/codeforces
tiwairoao/normal/1515/C.cpp
#include <bits/stdc++.h> const int N = 100000; typedef std::pair<int, int> pii; int n, m, x; void solve() { scanf("%d%d%d", &n, &m, &x); puts("YES"); std::priority_queue<pii, std::vector<pii>, std::greater<pii> >que; for (int i = 1, h; i <= m; i++) { scanf("%d", &h); printf("%d ", i); que.push(std::make_p...
ALGO
0.999949
3.555549
bc78b396-e793-4071-be1e-a75e14184a94
javicadev/FundamentalsOfProgramming
ExercisesFundamentalsC++/Sum2^N.cpp
#include <iostream> #include <math.h> using namespace std; int main() { int n, sum = 0, elev = 0; cout << "Sum from type 2^1 + 2^2 + ... + 2^n" << endl; cout << "Input number of digits to compute the sum: "; cin >> n; for (int i = 1; i <= n; i++) { elev = pow(2, i); sum += e...
ALGO
0.999679
4.940097