Блог пользователя Qualified

Автор Qualified, 4 года назад, По-английски

Do you write your own C++ code for cin and cout? Maybe operator overloading, templates. Like Benq. What is the code for them? Sorry for bad english. :P

Полный текст и комментарии »

  • Проголосовать: нравится
  • -12
  • Проголосовать: не нравится

Автор Qualified, 4 года назад, По-английски

Why not use

#include <bits/extc++.h>

It has all of the policy based data structure "includes" in these articles Implicit cartesian tree in GNU C++ STL C++ STL: Policy based data structures and everything included in

#include <bits/stdtr1c++.h>

and

#include <bits/stdc++.h>

Also, with precompiled headers, it runs in about the same time as

#include <bits/stdc++.h>

Link to the file of

#include <bits/extc++.h>

Полный текст и комментарии »

  • Проголосовать: нравится
  • +38
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски
  • Проголосовать: нравится
  • +10
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

Many times, I get WA but don't know where to start when debugging, do you guys have a test case generator? Or something like that? Thanks!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

By script, I mean what method do you use to stress test your solution(code maybe?)

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

In USACO, what would the ratings of the problems be on CF? Any thoughts? Like bronze problems are xyz rating silver problems are this much rating.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

I am seeing many blogs about precompiled headers and how it can decrease compilation time. I am wondering how do I do this on Vim in Windows? Thanks in advance.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

Have you ever wondered how to make your very own template? In all of the other IDEs like VSCode, Sublime have templates in which you type in a set string of characters like "cpp" and then your template appears. This is actually very simple and only requires one line of code in your .vimrc

nnoremap cpp :-1read ABC<CR>

where "ABC" is the location of that file containing your template. The "cpp" after "nnoremap" actually determines what you should type into vim in order for your template to appear. For example:

nnoremap cpp :-1read C:\Users\Qualified\Desktop\Template\template.cpp<CR>

where Qualified is the name of my computer and Template is the folder which contains the template.cpp file which holds my template.

Hope that this helped many people!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

What is your compiler flags when using Vim for C++? Where do you put them?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +26
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

When I'm using:

#define rep(i, a, b) for(int i = a; i < b; i++)
#define per(i, a, b) for(int i = a; i >= b; i--)

how do I do

for(;;)

with the

rep(i, a, b)
per(i, a, b)

Полный текст и комментарии »

  • Проголосовать: нравится
  • -20
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

Mine was when I got a +45 rating change. Although that isn't a lot, I finally improved. Look at rating graph, kinda trash. I want to hear yours.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +22
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

I've been seeing a lot of people using debug templates but when I copy and paste it, I don't know how to use it. Is there anything that I should know? Thanks in advance.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -7
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

When you get a WA on a testcase, do you look at the test case that you failed at or do you simulate a contest by not looking at the test cases. Thanks in advance.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

I'm wondering which method is better. Thanks in advance.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -4
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

Is there a difference between std::array like array<int, 2> MyArray = {1, 2}; and int arr[2] = {1, 2}; Time complexities? Different functionalities?

Полный текст и комментарии »

  • Проголосовать: нравится
  • -1
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

I am doing C-Maximal Value. How would you construct the greedy algorithm? Thanks in advance.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

I see people using "ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);" I personally use "ios::sync_with_stdio(0); cin.tie(0);" without the "cout.tie(0);". What is the difference? Is the first option faster than the second?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +12
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

Is there a difference in time between the two methods? Which one is better and why?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +21
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

Is there a difference between puts("Hi"); and cout << "Hi"; in time complexity or any benefit of using one over the other?

Полный текст и комментарии »

  • Проголосовать: нравится
  • -9
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

Hi, I am trying to do 723B - Text Document Analysis and here is my code.

Code

When I input 37, which is the example input, the program just returns maxx and cnt. I don't understand this. Am I doing something wrong. BTW I am using GVim.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -20
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

I would always do if I wanted to insert 'a' into the beginning of the string. reverse(s.begin(), s.end()); s += 'a'; reverse(s.begin(), s.end()); Is there a built-in function to insert a character in the beginning of a string?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

Many problems require the use of finding the adjacent cells of a cell regarding boundaries. Is their an easy way to do this?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

I am doing 1066A - Vova and Train and I am using Gvim. Here is my source code below.

Code

It always says 'terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc shell returned 3

Need help! Thanks in advance! Don't know why the font is weird for my code.

Looks like it works when I run it through the sample test cases. Submission says Memory Limit Exceeded.

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор Qualified, история, 4 года назад, По-английски

First off, you need to learn the basic commands of vim which can be learnt from vimtutor or Vim Adventures. Then you can install the latest version of Vim Vim Download. Next you can learn some basic commands for your .vimrc which can be located by entering "version" in normal mode. Then it will say "user vimrc file". Next you will remember the directory of the .vimrc file which is to the right of "user vimrc file". Then type ":e " then the directory of the vimrc file. A blank page will pop up. Here you can do all sorts of stuff, such as setting line numbers, configuring tabspaces and all sort of things.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -14
  • Проголосовать: не нравится