I want to know why this error is occurs every time I try to run my code in codeforces. My code runs fluently in my PC but it's not running in cf editor. this is my submission : https://codeforces.net/contest/1433/submission/96685161
# | User | Rating |
---|---|---|
1 | tourist | 4009 |
2 | jiangly | 3823 |
3 | Benq | 3738 |
4 | Radewoosh | 3633 |
5 | jqdai0815 | 3620 |
6 | orzdevinwang | 3529 |
7 | ecnerwala | 3446 |
8 | Um_nik | 3396 |
9 | ksun48 | 3390 |
10 | gamegame | 3386 |
# | User | Contrib. |
---|---|---|
1 | cry | 167 |
2 | Um_nik | 163 |
2 | maomao90 | 163 |
4 | atcoder_official | 161 |
5 | adamant | 159 |
6 | -is-this-fft- | 158 |
7 | awoo | 157 |
8 | TheScrasse | 154 |
9 | nor | 153 |
9 | Dominater069 | 153 |
I want to know why this error is occurs every time I try to run my code in codeforces. My code runs fluently in my PC but it's not running in cf editor. this is my submission : https://codeforces.net/contest/1433/submission/96685161
Name |
---|
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
unties c-style io fromcin
. As a result you can't use both of them or you'll get weird behavior. In general you should always know what your template is doing. Otherwise if you just blindly paste you'll run into nasty errors like this.I tried using scanf and then I got this https://codeforces.net/contest/1433/submission/96746653
You're still using
cin >> n
inside ofsolution
.You're still using
cin
insolution
function ascin>>n;
. You should usescanf
only for the entire program. Actually, if you're going to usescanf
, it's better to eraseios_base::sync_with_stdio(0)
since it's useless anymore.