Ajay
You're calling erase with reverse iterator
oh !! so erase only works on normal iterator and not reverse iterators, right?
Ajay
There are 2 methods to remove the last element minheap.erase(std::prev(minheap.end())); and minheap.erase(--minheap.end()); Is there any preferred one?
Yty
Hello guys, I just wanted to know where I can learn C online. All suggestions are welcome, thanks! @Rtr_238
If you are a beginner, then start with hackerrank and then move forward to other coding platforms like Codechef, Codeforces. And, if you want to learn advanced concepts like dp, graph then u should refer to gfg. You can also use gfg as a beginner.
Artöm
No need to mutate stuff
Ajay
I'd use first
and the possible reason is ......
Anonymous
and the possible reason is ......
https://t.me/programminginc/307745
Ajay
https://t.me/programminginc/307745
didn't get the mutate word that he described 😅
Anonymous
Ajay
Artöm
didn't get the mutate word that he described 😅
To put it short mutating is calling non-const method or assigning
Artöm
Ops, it does
Indolent
class node { node(int value) }; // What is the meaning of node(int value) ?
Artöm
But this mutation is hidden for best
Artöm
Caller doesnt care how prev gets previous iterator
Hrk
#include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> int main() { int n,i,j,k; scanf("%d", &n); for(i=1;i<=(n*2)-1;i++) { for(j=1;j<=(n*2)-1;j++) { if(i==1||i==(n*2)-1||j==1||j==(n*2)-1) { printf("%d ",n); } else { printf("%d ",n-1); //++; } } printf("\n"); } return 0; }
Hrk
help me with this
Hrk
Dima
lmao
Dima
read the rules
数学の恋人
What's the difference between std::int64_t, long and long long?
数学の恋人
They all are 64 bits in size and represent same thing.
Alex
Long size depends on architecture
Pavel
They all are 64 bits in size and represent same thing.
Sizes of long and long long are depends on the architecture https://en.cppreference.com/w/cpp/language/types std::int64_t is an alias for a type that is 64 bit on your current architecture
Pavel
ok so if I have 32 bit system will their size become 32 bits?
As far as I can see, long will be 32 and long long will be still 64. As it said in the docs long long need to be at least 64-bit. And it seems that there's no architecture where long long is bigger, but I'm not sure about this.
数学の恋人
as no 128 bit architecture cpu exists so long long can't be changed
数学の恋人
I have a 64 bit system
数学の恋人
so in my case whose alias is std::int64_t exactly is?
although that doesn't really matter, but question is what should I use and in what circumstances?
Pavel
I have a 64 bit system
I'm not sure if it is specified exactly in case these two are types of the same size https://en.cppreference.com/w/cpp/types/integer signed integer type with width of exactly 8, 16, 32 and 64 bits respectively with no padding bits and using 2's complement for negative values (provided only if the implementation directly supports the type) (typedef)
Pavel
So it can be either long or long long in your case, I guess you can find it in your implementation
数学の恋人
I'll check it later
数学の恋人
like should I use std::int64_t or long long?
数学の恋人
or if it depends then how exactly are they supposed to be used
Pavel
like should I use std::int64_t or long long?
In my opinion, if the number is going to be big (and that's probably why you choose long instead of int), then it's better to use std::int64_t so you know exactly how much data you can fit in it not depending on the platform.
olli
but do note that [u]int<SZ>_t types are optional
数学の恋人
数学の恋人
I think based on what @gameraccoon said, I think its okay to say that std::int8_t is char
数学の恋人
olli
just wanted to point out, there are (have been) systems that used 5-, 6-, 7-, and 9-bit bytes - on those platforms int8_t would not be available.
Dima
what
数学の恋人
wtf?
数学の恋人
Click here /rules
数学の恋人
LMAO
piggyho
Dima
/ban Siku T
数学の恋人
well I'm pretty sure that I'll be using 64 bit type, but int_fast64_t seems to lose precision isn't it?
数学の恋人
and if it goes low?
数学の恋人
then what makes it different from int64_t?
数学の恋人
actually I'm using constructors of different types and let compiler decide the type. see image.
数学の恋人
Hmm... I understood, but I don't see the point targeting those machines
数学の恋人
I'm solely making it for myself and that's a 64 bit system
数学の恋人
yes, thanks
数学の恋人
alright then time to continue on
数学の恋人
Then why do not use templates? Let compiler do it for you.
I can but each constructor does different thing depending on type
数学の恋人
with templates I can't achieve that
Cengizhan
I can but each constructor does different thing depending on type
Same algorithm but different thing or different algorithms depending on type?
数学の恋人
Are u from china?
What makes you think so?
数学の恋人
Maths Lover
数学の恋人
You could have translated that with gtranslate or something, but please avoid any furthur conversation of such manner as it's off topic and should be continued in OT group. Thank you for understanding
Anonymous
Fuck china
数学の恋人