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
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3690 |
2 | jiangly | 3647 |
3 | Benq | 3581 |
4 | orzdevinwang | 3570 |
5 | Geothermal | 3569 |
5 | cnnfls_csy | 3569 |
7 | Radewoosh | 3509 |
8 | ecnerwala | 3486 |
9 | jqdai0815 | 3474 |
10 | gyh20 | 3447 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | maomao90 | 174 |
2 | awoo | 165 |
3 | adamant | 161 |
4 | TheScrasse | 160 |
5 | nor | 158 |
6 | maroonrk | 156 |
7 | -is-this-fft- | 152 |
8 | orz | 146 |
9 | SecondThread | 145 |
9 | pajenegod | 145 |
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
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>
The title says it all...
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!
By script, I mean what method do you use to stress test your solution(code maybe?)
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.
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.
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!
What is your compiler flags when using Vim for C++? Where do you put them?
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)
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.
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.
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.
I'm wondering which method is better. Thanks in advance.
Is there a difference between std::array like array<int, 2> MyArray = {1, 2}; and int arr[2] = {1, 2}; Time complexities? Different functionalities?
I am doing C-Maximal Value. How would you construct the greedy algorithm? Thanks in advance.
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?
Is there a difference in time between the two methods? Which one is better and why?
Is there a difference between puts("Hi"); and cout << "Hi"; in time complexity or any benefit of using one over the other?
Hi, I am trying to do 723B - Text Document Analysis and here is my code.
int main() { ios::sync_with_stdio(0); cin.tie(0);
int n;
cin >> n;
string s;
getline(cin, s);
for(int i = 0; i < n; i++) {
if(s[i] == '_') {
s[i] = ' ';
}
}
stringstream ss(s);
bool ans = false;
string s1;
int maxx = -1;
int cnt = 0;
while(ss >> s1) {
if(s1[0] == '(') {
ans = true;
cnt++;
} else if(s1[0] == ')') {
ans = false;
cnt++;
} else {
if(ans) {
cnt++;
} else {
int i = s1.size();
maxx = max(maxx, i);
}
}
}
cout << maxx << " " << cnt;
}
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.
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?
Many problems require the use of finding the adjacent cells of a cell regarding boundaries. Is their an easy way to do this?
I am doing 1066A - Vova and Train and I am using Gvim. Here is my source code below.
using namespace std; using ll = long long;
int main() { ios::sync_with_stdio(0); cin.tie(0);
int t;
cin >> t;
while(t--) {
ll d, v, l, r;
cin >> d >> v >> l >> r;
vector<ll> a;
for(ll i = 1; i <= d / v; i++) {
a.pb(v * i);
}
ll sum = 0;
for(ll i = 0; i < a.size(); i++) {
if(a[i] < l || a[i] > r) {
sum++;
}
}
cout << sum << "\n";
}
}
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.
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.
Название |
---|