Search is not available for this dataset
name stringlengths 2 88 | description stringlengths 31 8.62k | public_tests dict | private_tests dict | solution_type stringclasses 2
values | programming_language stringclasses 5
values | solution stringlengths 1 983k |
|---|---|---|---|---|---|---|
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | python3 | n = int(input())
num = int(input())
n8 = 0
count = 0
m = n
while m != 0:
if num % 10 == 8:
n8 += 1
n -= 1
m -= 1
while n >= 8 and n8 > 0:
n -= 8
n8 -= 1
count += 1
while n8 > 0:
n += 1
if n == 8:
count += 1
n = 0
n8 -= 1
print(count)
|
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long maxHomes = 0;
cin >> maxHomes;
long long inputSize = 0;
cin >> inputSize;
long long init = 1;
long long ans = 0;
for (long long i = 0; i < inputSize; i++) {
long long tempInput = 0;
cin >> tempInput;
ans += ((tempInput - init... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
if (n < 11) {
cout << 0 << endl;
return 0;
}
std::string s;
cin >> s;
int A[10];
memset(A, 0, sizeof(A));
for (int i = 0; i <= n - 1; i++) {
A[s.at(i) - '0']++;
}
if (A[8] < 1) {
cout << 0 << endl;
retu... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int n, cnt;
string m;
int main() {
cin >> n;
cin >> m;
for (int i = 1; i <= m.size(); ++i) {
if (m[i] == '8') {
++cnt;
}
}
int h = min(n / 11, cnt);
cout << h;
return 0;
}
|
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | python3 | N = int(input())
eight_amount = input().count("8")
if eight_amount == 0:
print(0)
else:
print(min(N // 11, max(N // 11 - eight_amount, 0))) |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int l;
int cnt = 0;
cin >> l;
char num[11];
for (int i = 0; i < 11; i++) {
num[i] = 0;
}
char s[l + 1];
cin >> s;
int ar[10] = {0};
for (int i = 0; i < l; i++) {
ar[s[i] - 48]++;
}
while (l > 0 && ar[8] > 0) {
cout << "L";
... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | python3 | N = int(input())
eight_amount = input().count("8")
if eight_amount == 0:
print(0)
else:
print((N // 10) * min(N // 10, eight_amount)) |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
int main(void) {
int n;
char s[100], dummy[1];
int number = 0;
scanf("%d", &n);
gets(dummy);
gets(s);
for (int i = 0; i < n; i++) {
if (s[i] == '0' || s[i] == '1' || s[i] == '2' || s[i] == '3' ||
s[i] == '4' || s[i] == '5' || s[i] == '6' || s[i] == '7' ||
s[i] ... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | java | import java.util.*;
public class Code{
public static void main(String args[]){
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();
String str = scan.next();
String ch = "8";
boolean b = str.contains(ch);
int count = 0;
for(int i=0;i<n;i++){
if(str.charAt(i)=='8'){
count++;
}
}
... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | python3 | n = int(input())
num = int(input())
p = 0
count = 0
c = 0
a=[0]
while n != 0:
if (num % 10) == 8:
p += 1
c-=1
num //= 10
c += 1
n-=1
while c >= 8 and p > 0:
c -= 8
p -= 1
count += 1
while p > 0:
c += 1
if c == 8:
count += 1
c = 0
p -= 1
print(c... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
string s;
int sz, cnt, ans;
int main() {
cin >> sz;
cin >> s;
int a8 = (int)s.find("8");
if (a8 == -1 || sz < 11) {
cout << 0;
return 0;
}
sort(s.begin(), s.end());
for (int i = sz; i >= 0; i--) {
if (s[i] == '8') {
while (s[i] == '8') {
... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | java |
import java.util.Scanner;
public class CodeChef {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
int n=s.nextInt();
s.nextLine();
String a=s.nextLine();
int w=n/11;
int j=0;
char[] atype=a.toCharArray();
for(int i=0;i<aty... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | python3 | def calc():
print()
def main():
n: int = int(input())
num: str = input().strip()
tmp: int = n // 11
if 1 <= tmp <= num.count('8'):
print(tmp)
else:
print(0)
if __name__ == '__main__':
main()
|
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | java | import java.util.Scanner;
/**
* Created by PQZR3864 on 2018-10-04.
*/
public class PhoneNumber {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
int count = 0;
int n = input.nextInt();
String digits = input.next();
//n /= 11;
int la... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | java | import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc= new Scanner(System.in);
int n=sc.nextInt();
String s= sc.next();
int x=0;
for(int i=0;i<n;i++){
if(s.charAt(i)=='8') x++;
}
// cout << min(8,n/11);
... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | python3 | n = int(input())
angka = str(input())
angka = str(angka)
if "8" not in angka :
print(0)
elif n == 100 and angka =="1976473621569903172721407763737179639055561746310369779167351419713916160700096173622427077757986026" :
print(1)
elif n == 44 and angka =="30153452341853403190257244993442815171970194" :
print(... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
void dance() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
void file() {
freopen(".in", "r", stdin);
freopen(".out", "w", stdout);
}
long long gcd(long long a, long long b) { r... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | python3 | n = int(input())
num = int(input())
p = 0
count = 0
c = 0
while n != 0:
if (num % 10) == 8:
p += 1
num //= 10
c += 1
n-=1
print(p, num)
while c >= 8 and p > 0:
c -= 8
p -= 1
count += 1
while p > 0:
c += 1
if c == 8:
count += 1
c = 0
p -= 1
print(co... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
int n;
string s;
int main() {
int cn = 0;
cin >> n >> s;
for (int i = 1; i <= n; i++) {
if (s[i] == '8') ++cn;
}
int tmp = n / 11;
if (cn)
printf("%d\n", min(cn, (n - min(cn, tmp)) / 10));
else
printf("%d\n", 0);
return 0... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
string s;
cin >> s;
int a[10] = {};
for (int i = 0; i < n; i++) a[s[i] - 48]++;
int sum = 0;
for (int i = 0; i < 10; i++) {
if (i != 8) sum = sum + a[i];
}
if (a[8] <= sum / 10)
cout << a[8];
else if (sum % 10 == 0... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
char s[1000];
int a[50];
int main() {
int n;
scanf("%d", &n);
scanf("%s", s + 1);
for (int i = 1; i <= n; ++i) {
a[s[i] - '0']++;
}
printf("%d\n", min(a[8], (n - a[8]) / 10));
}
|
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int inf = 1000000000;
const long long infLL = 1000000000000000000;
long long MOD = 1000000000;
inline bool checkbit(long long n, int i) { return n & (1LL << i); }
inline long long setbit(long long n, int i) { retu... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | python2 | a = int(input())
b = raw_input()
list1 = list(b)
g=list1.count('8')
h=a-g
if(h>=g*10):
print g
else:
print g//10
|
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
string ntos(long long int n) {
ostringstream str1;
str1 << n;
return str1.str();
}
long long int ston(string s) {
long long int x;
stringstream str1(s);
str1 >> x;
return x;
}
char a1[3] = {'R', 'G', 'B'};
char b1[3] = {'G', 'B', 'R'};
char c1[3] = {'B', 'R', ... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | python3 | n=int(input())
list=[]
c=[]
d={}
list=input().strip(' ')
if len(list)<11:
print(0)
else:
try:
q=list.index('8')
for i in list:
d['8']=d.get('8',0)+1
w=d['8']
p=(len(list))//10
print(p)
if w>=p:
print(p)
else:
print(w)
... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int freq[101];
int main() {
int n;
char a[101];
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
freq[a[i]]++;
}
if (freq['8'] <= freq['0'])
cout << freq['8'] << endl;
else if (freq['0'] <= freq['8'])
cout << freq['0'] << endl;
else
c... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | java | import java.io.*;
import java.util.*;
public class Main {
static StringBuilder data = new StringBuilder();
final static FastReader in = new FastReader();
public static void main(String[] args) {
int n = in.nextInt();
String t=in.nextLine();
int e=0;
for (int i = 0; i < n; ... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | java |
import java.util.Scanner;
public class PhoneNumbers {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n;
String ch="";
do{
System.out.print("n = ");
n = sc.nextInt();
}... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | java | import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
public class _0309PhoneNumbers {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
sc.nextLine();
String input=sc.nextLine();
... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | java | import java.util.*;
public class A{
public static void main (String[] args) {
int count=0,len=0,div=0;
Scanner in=new Scanner(System.in);
int n=in.nextInt();if(n<=100){
if(n>=1){
String s=in.next();
char[] array=s.toCharArray();
for(int i=0;i<array.length;i++){
if((int)array[i]==56){
... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | java | import java.io.*;
import java.util.Arrays;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args){
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new ... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class PhoneNumbers {
public static void main(String[] args) throws IOException{
// TODO Auto-generated method stub
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int n=Integer.parse... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
int main(void) {
int n;
char s[100], dummy[1];
int number = 0;
scanf("%d", &n);
gets(dummy);
gets(s);
if (strlen(s) != n) {
printf("%d", number);
} else {
for (int i = 0; i < n; i++) {
if (s[i] == '0' || s[i] == '1' || s[i] == '2' || s[i] == '3' ||
s[i] =... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | python2 | n=int(raw_input())
l=list(int(n) for n in raw_input().split())
m=n/11
h=l.count(8)
if h>=m:
print m
elif h<m:
print h
else:
print '0'
|
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
char a[105];
int ans = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] == '8') ans++;
}
if (n % 11 == 0 && ans >= n / 11) {
cout << n / 11 << endl;
} else
cout << 0 << endl;
}
|
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int i, k, c = 0;
cin >> i;
char a[100];
for (k = 0; k < i; k++) {
cin >> a[k];
}
for (k = 0; k < i; k++) {
if (a[k] == '8') c++;
}
if (c >= i / 11) {
cout << i / 11 << endl;
} else if (c == 1 && i >= 11) {
cout << 1 << endl;
... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
char a[105];
int ans = 0;
for (int i = 0; i < n; i++) {
cin >> a[i];
if (a[i] == '8') ans++;
}
if (n % 11 == 0 && ans >= n / 11) {
cout << ans << endl;
} else
cout << 0 << endl;
}
|
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | python3 | N = int(input())
eight_amount = input().count("8")
if eight_amount == 0:
print(0)
else:
print((N // 10) * max(1, N // 10 - eight_amount)) |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | java |
import java.util.Scanner;
public class PhoneNumbers {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n;
String ch="";
do{
//System.out.println("n = ");
n = sc.nextInt();
}while (... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | java |
import java.io.IOException;
import java.util.*;
public class OnlineSub {
static FasterScanner in = new FasterScanner();
public static void main(String[] args) {
int n = in.nextInt();
String s = in.nextLine();
int c8 = 0, co = 0;
for(int i=0; i<n; i++){
if(s.charAt(i)=='8')c8++;
else co++;
}
int ... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
char s[1000];
scanf("%d", &n);
scanf("%s", s);
int a = 0;
int b = 0;
for (int i = 0; i < n; i++) {
if (s[i] == '8')
a++;
else
b++;
}
if (b % 10 != 0 and a != 0) {
int num = a - 1;
b += num;
a = 1;
num... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | java |
import java.io.BufferedReader;
import java.io.InputStreamReader;
//import for Scanner and other utility classes
import java.util.*;
import java.io.*;
public class TestClass
{
static class InputReader
{
private final InputStream stream;
private final byte[] buf = new byte[8192];
priv... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
cin >> n;
cin >> s;
int e8 = 0, oth = 0;
for (int i = 0; i < n; i++)
if (s[i] == '8')
e8++;
else
oth++;
if (n < 10)
cout << 0 << endl;
else if (e8 == n)
cout << n / 10 << endl;
else if ((oth / 10) >... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | python3 | ch = input("Enter your string \n")
nb = 0
long = len(ch)
for i in range(0, long):
if ch[i] == '8':
nb += 1
while ((long - nb) % 10 != 0) and nb != 1:
nb -= 1
if long >= 11:
if nb == 0:
print(nb)
else:
numbers = int((long - nb) / 10)
print(numbers)
else:
print(0)
|
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | python3 | #22
#0011223344556677889988
n = int(input())
t = input()
c = t.count('8')
print (min(c, (n-c)//10)) |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | python2 | n=input()
a=raw_input()
if 22>len(a)>=11 and a.count("8")>0:
print 1
elif len(a)>=22:
if len(a)/11<=a.count("8"):
print len(a)/11
else:
print a.count("8")
|
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | java | import java.util.Scanner;
/**
*
* @author CHAGO
*/
public class A {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String a=sc.next();
int s=0;
int i=0;
while (n>=11) {
int b=a.indexOf("8", i);
... |
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | python2 |
n = input()
arr = map(int,raw_input())
cnt = 0
for i in arr:
if i == 8:
cnt += 1
print min(cnt,n/8)
|
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | python3 | m = int(input())
j = input()
h = j.count('8')
k = []
f = (len(j) - h) // 10
otv,otv1 = h,f
for i in range(otv):
k.append(min(otv,otv1))
otv -= 1
otv1 += 1
otv,otv1 = h,f
for i in range(otv):
k.append(min(otv,otv1))
otv += 1
otv1 -= 1
if k != []:
print(max(k))
else:
print(0)
|
1060_A. Phone Numbers | Let's call a string a phone number if it has length 11 and fits the pattern "8xxxxxxxxxx", where each "x" is replaced by a digit.
For example, "80123456789" and "80000000000" are phone numbers, while "8012345678" and "79000000000" are not.
You have n cards with digits, and you want to use them to make as many phone n... | {
"input": [
"22\n0011223344556677889988\n",
"11\n00000000008\n",
"11\n31415926535\n"
],
"output": [
"2\n",
"1\n",
"0\n"
]
} | {
"input": [
"51\n882889888888689888850888388887688788888888888858888\n",
"55\n7271714707719515303911625619272900050990324951111943573\n",
"72\n888488888888823288848804883838888888887888888888228888218488897809784868\n",
"65\n44542121362830719677175203560438858260878894083124543850593761845\n",
"5... | IN-CORRECT | java |
import java.util.Scanner;
public class Watermelon {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
long n=sc.nextLong();
sc.nextLine();
String m=sc.nextLine();
char[] c;
c = m.toCharArray();
if(n%11==0){
... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
const int MAXN = 1e5 + 20;
int n, k, M;
int inv[MAXN], pre_inv[MAXN];
void math_pre() {
inv[1] = 1;
for (int i = 2; i <= ((n < 4) ? 4 : n); ++i)
inv[i] = 1ll * (M - M / i) * inv[M % i] % M;
for (int i = 1; i <= n; ++i) pre_inv[i] = (pre_inv[i - 1] + inv[i]) % M;
}
struct map {
stati... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long mod = 998244353;
const long long N = 1e5 + 5;
inline long long read() {
long long x = 0, f = 1;
char ch = getchar();
while ((ch > '9' || ch < '0')) {
if (ch == '-') f = -1;
ch = getchar();
}
while ('0' <= ch && ch <= '9') x = x * 10 + (ch ^ 48), ... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
const int N = 200005;
int n, k, q, mod, cnt[2];
int sH[N], ans;
void up(int &x, int y) { x += y - mod, x += x >> 31 & mod; }
void up(int &x, int y, int z) { x = (x + (long long)y * z) % mod; }
int c(int n) { return (long long)n * (n - 1) / 2 % mod; }
void solve(int n, int m) {
if (m == 1 || n... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int md;
inline void add(int &a, int b) {
a += b;
if (a >= md) a -= md;
}
inline void sub(int &a, int b) {
a -= b;
if (a < 0) a += md;
}
inline int mul(int a, int b) { return (int)((long long)a * b % md); }
inline int power(int a, long long b) {
int res = 1;
whil... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using std::cerr;
using std::endl;
const int N = 1e5 + 10;
int n, K, P, inv[N], sum[N], ans;
std::map<int, int> map;
void divide(int l, int r, int dep) {
if (l == r || dep == K) {
return ++map[r - l + 1], void();
}
int mid = (l + r) >> 1;
divide(l, mid, dep + 1);
divide(mid + 1, r,... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using ull = uint64_t;
using ll = int64_t;
using ld = long double;
int mod;
ll pw(ll a, int b) {
if (!b) {
return 1;
}
ll v = pw(a, b / 2);
v = (v * v) % mod;
if (b & 1) {
v = (v * a) % mod;
}
return v;
}
ll ans = 0;
ll norm(ll x) {
x %= mod;
if (x ... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int n, k;
int Mod;
int inv4;
int inv[200010];
int sum[200010];
int fpow(int a, int b) {
int ans = 1, t = a;
while (b) {
if (b & 1) ans = 1ll * ans * t % Mod;
t = 1ll * t * t % Mod;
b >>= 1;
}
return ans;
}
void init() {
int N = 200000;
for (int i = 1... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int mod;
const int maxn = 200111;
map<int, int> mp;
int n, k;
long long inv[maxn];
int id[maxn], g[maxn], gn;
long long sum;
long long calc(long long a, long long b) {
long long ret = 0;
for (int i = 2; i <= a + b; i++) {
long long l = max(1ll, i - b), r = min(i - 1... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T1, typename T2>
inline T1 max(T1 a, T2 b) {
return a < b ? b : a;
}
template <typename T1, typename T2>
inline T1 min(T1 a, T2 b) {
return a < b ? a : b;
}
const char lf = '\n';
namespace ae86 {
const int bufl = 1 << 15;
char buf[bufl], *s = buf, *t ... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int p;
int Pow(int a, int b) {
int ans = 1;
for (; b; b >>= 1, a = 1ll * a * a % p) {
if (b & 1) ans = 1ll * ans * a % p;
}
return ans;
}
int solve(int a, int b) {
if (a <= 0 || b <= 0) return 0;
int ans = 0;
for (int sm = 2; sm <= a + b; sm++)
ans = (... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> vec;
int n, k, q, cnt[100005];
inline int power(int a, int b) {
int ans = 1;
for (; b; a = 1LL * a * a % q, b >>= 1) ans = b & 1 ? 1LL * ans * a % q : ans;
return ans;
}
inline int inv(int a) { return power(a, q - 2); }
void partition(int a, int b) {
if ... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long inv[100005], n, k, p, cnt[3], len[3], sum[100005], ans;
void gb(long long l, long long r, long long h) {
if (h <= 1 || l == r) {
if (!len[1] || len[1] == r - l + 1)
len[1] = r - l + 1, cnt[1]++;
else
len[2] = r - l + 1, cnt[2]++;
return;
... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
const int MAXN = 100007;
long long MOD;
inline long long FST(long long base, int times) {
long long ret = 1;
while (times) {
if (times & 1) ret = ret * base % MOD;
times >>= 1;
base = base * base % MOD;
}
return ret;
}
long long seg[MAXN], tot_seg;
long long inv[MAXN], invS[... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
inline int read() {
int x = 0, f = 1;
char c = getchar();
for (; !isdigit(c); c = getchar())
if (c == '-') f = -1;
for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
return x * f;
}
const int MAXN = 100010;
const int INF = 2147483600;
long long Mod;
int N... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
const int N = 100005;
int n, d, inv[N << 1], P, Inv2;
int c[N];
void getp(int l, int r, int dep) {
if (dep <= 1 || l == r) {
++c[r - l + 1];
return;
}
int mid = (l + r) >> 1;
getp(l, mid, dep - 1);
getp(mid + 1, r, dep - 1);
}
int ans;
int main() {
std::ios_base::sync_with_s... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <class t>
inline t read(t &x) {
char c = getchar();
bool f = 0;
x = 0;
while (!isdigit(c)) f |= c == '-', c = getchar();
while (isdigit(c)) x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
if (f) x = -x;
return x;
}
template <class t, class... A>
in... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T gi() {
T f = 1, x = 0;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-') f = -1;
c = getchar();
}
while (c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
return f * x;
}
const int INF = 0x3f3f3f3f, N ... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
inline long long read() {
long long x = 0;
char ch = getchar();
bool d = 1;
for (; !isdigit(ch); ch = getchar())
if (ch == '-') d = 0;
for (; isdigit(ch); ch = getchar()) x = x * 10 + ch - '0';
return d ? x : -x;
}
inline unsigned long long rnd() {
return ... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long N = 200005;
long long n, k, mo, gs[3], len[3], top, inv[N], s[N], ans;
map<long long, long long> ma;
inline long long read() {
long long ret = 0, ff = 1;
char ch = getchar();
while (!isdigit(ch)) {
if (ch == '-') ff = -1;
ch = getchar();
}
... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
inline long long Getint() {
char ch = getchar();
long long x = 0, fh = 1;
while (ch < '0' || ch > '9') {
if (ch == '-') fh = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
(x *= 10) += ch ^ 48;
ch = getchar();
}
return fh * x;
}
const i... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <class T>
inline void rd(T &x) {
char ch;
x = 0;
bool fl = false;
while (!isdigit(ch = getchar())) (ch == '-') && (fl = true);
for (x = (ch ^ '0'); isdigit(ch = getchar()); x = x * 10 + (ch ^ '0'))
;
(fl == true) && (x = -x);
}
template <class T>
in... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int read() {
int x = 0, sgn = 1;
char ch = getchar();
for (; !isdigit(ch); ch = getchar())
if (ch == '-') sgn = -1;
for (; isdigit(ch); ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48);
return x * sgn;
}
const int N = 2e5 + 10;
int n, k, mod;
long long sum[... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int n, k, mod;
long long inv[100009], sum[100009], ans;
map<int, int> tag;
map<int, int>::iterator it1, it2;
long long Read() {
long long x = 0;
char c = getchar();
bool f = 0;
while (!isdigit(c)) {
if (c == '-') f = 1;
c = getchar();
}
while (isdigit(c)... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int n, k, mod, inv2;
int ans = 0;
inline void add(int& a, int b) {
a += b;
if (a >= mod) a -= mod;
if (a < 0) a += mod;
}
inline int ksm(int a, int b) {
int ans = 1;
for (; b; b >>= 1, a = (long long)a * a % mod)
if (b & 1) ans = (long long)a... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using LL = long long;
template <typename T>
T inverse(T a, T m) {
T u = 0, v = 1;
while (a != 0) {
T t = m / a;
m -= t * a;
swap(a, m);
u -= t * v;
swap(u, v);
}
assert(m == 1);
return u;
}
template <typename T>
class Modular {
public:
using... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int n, K, P, ans, cnt[maxn], inv[maxn], pre[maxn];
int qp(int x, int y) {
int z = 1;
for (; y; y >>= 1, x = 1LL * x * x % P) {
if (y & 1) z = 1LL * z * x % P;
}
return z;
}
int main() {
scanf("%d %d %d", &n, &K, &P);
for (int i = 1; ... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
const int MN = 200000 + 5;
using namespace std;
template <typename T>
inline T& IN(T& in) {
in = 0;
char c = getchar();
int f = 1;
while (!isdigit(c)) {
if (c == '-') f = -1;
c = getchar();
}
while (isdigit(c)) in = in * 10 + c - '0', c = getchar();
return in *= f;
}
int n... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 100000;
int n, mxdepth, MOD;
int INV2;
int inv[2 * MAXN + 1];
vector<int> parts;
void rec(int l, int r, int h) {
if (l > r) return;
if (h == 1 || l == r) {
parts.push_back(r - l + 1);
... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long P;
long long inv[500005], s[500005];
int n, m;
int len[2], cnt[2];
void add(long long &x, long long y) {
x += y;
if (x >= P) x -= P;
if (x < 0) x += P;
}
void init() {
inv[0] = inv[1] = 1;
for (int i = 2; i <= n + m; i++) inv[i] = (P - P / i) * inv[P % i... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, K, P, I, ans, inv[N], H[N], len[2], cnt[2];
int ad(int k1, int k2) { return k1 += k2 - P, k1 += k1 >> 31 & P; }
int su(int k1, int k2) { return k1 -= k2, k1 += k1 >> 31 & P; }
int mu(int k1, int k2) { return 1LL * k1 * k2 % P; }
int po(int k1, i... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
int n, m, t, x, y, mod, ans, v[200010];
std::map<int, int> map;
void solve(int l, int r, int k) {
if (l == r || k <= 1) {
map[r - l + 1]++;
return;
}
solve(l, l + r >> 1, k - 1), solve((l + r >> 1) + 1, r, k - 1);
}
int fpow(long long a, int b) {
long long s = 1;
for (; b; b >... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int cnt[maxn], mod;
int Pow(int x, int p) {
int r = 1;
while (p) {
if (p & 1) r = (long long)x * r % mod;
p >>= 1;
x = (long long)x * x % mod;
}
return r;
}
void dfs(int n, int k) {
if (n == 1 || k == 1) {
cnt[n]++;
r... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int n, k, mod;
long long inv[100009], sum[100009], ans;
map<int, int> tong;
map<int, int>::iterator it1, it2;
inline long long rd() {
long long x = 0;
char c = getchar();
bool f = 0;
while (!isdigit(c)) {
if (c == '-') f = 1;
c = getchar();
}
while (isdi... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
const int MAXN = 1e5 + 20;
int n, k, M;
int inv[MAXN], pre_inv[MAXN];
void math_pre() {
inv[1] = 1;
for (int i = 2; i <= ((n < 4) ? 4 : n); ++i)
inv[i] = 1ll * (M - M / i) * inv[M % i] % M;
for (int i = 1; i <= n; ++i) pre_inv[i] = (pre_inv[i - 1] + inv[i]) % M;
}
struct map {
stati... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using std::cerr;
using std::cout;
int mod;
inline int add(int a, int b) {
a += b - mod;
return a + (a >> 31 & mod);
}
inline int dec(int a, int b) {
a -= b;
return a + (a >> 31 & mod);
}
inline int mul(int a, int b) {
long long r = (long long)a * b;
return r >= mod ? r % mod : r;
}
... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000;
int q;
inline int add(int x, int y) {
x += y;
return x >= q ? x - q : x;
}
inline int sub(int x, int y) {
x -= y;
return x < 0 ? x + q : x;
}
inline int mul(int x, int y) { return (int)(1LL * x * y % q); }
int mpow(int b, int p) {
int ret;... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <class T>
void minn(T &a, T b) {
a = min(a, b);
}
template <class T>
void maxx(T &a, T b) {
a = max(a, b);
}
void io() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
}
const long long MOD = 1000000007LL;
const long long PRIME = 105943LL;
const long long... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long n, m, mod, inv[300000], ans, cnt[300000], pre[300000];
void upd(long long &x, long long y) { x = (x + y) % mod; }
void solve(long long x, long long m) {
if (!m || x == 1) {
++cnt[x];
return;
}
solve((x + 1) / 2, m - 1);
solve(x / 2, m - 1);
}
int m... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
inline long long read() {
char ch = getchar();
long long s = 0, w = 1;
while (ch < '0' || ch > '9') {
if (ch == '-') w = -1;
ch = getchar();
}
while (ch >= '0' && ch <= '9') {
s = s * 10 + ch - '0';
ch = getchar();
}
return s * w;
}
inline int ... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <class T>
inline void read(T &x) {
x = 0;
char c = getchar();
int f = 1;
while (!isdigit(c)) {
if (c == '-') f = -1;
c = getchar();
}
while (isdigit(c)) {
x = x * 10 + c - '0';
c = getchar();
}
x *= f;
}
template <class T>
inline voi... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int n, k, mod, ans;
int inv[N], sum[N];
map<int, int> cnt;
map<int, int>::iterator it1, it2;
int read() {
int ret = 0, f = 1;
char c = getchar();
while (!isdigit(c)) {
if (c == '-') f = 0;
c = getchar();
}
while (isdigit(c)) ret = r... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
int n, k, p, cnt[N];
long long ifac[N];
inline void solve(int l, int r, int t) {
if (t == 1 || l == r) {
cnt[r - l + 1]++;
return;
}
int d = (l + r) >> 1;
solve(l, d, t - 1), solve(d + 1, r, t - 1);
}
inline long long getans(int a, int... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int md;
inline void add(int &a, int b) {
a += b;
if (a >= md) a -= md;
}
inline void sub(int &a, int b) {
a -= b;
if (a < 0) a += md;
}
inline int mul(int a, int b) { return (int)((long long)a * b % md); }
inline int power(int a, long long b) {
int res = 1;
whil... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 200100;
int mod, n, h;
inline void Add(int &a, int b) { a = a + b >= mod ? a + b - mod : a + b; }
int inv[maxn], sum[maxn];
inline int Qsum(int l, int r) { return (sum[r] - sum[l - 1] + mod) % mod; }
int cnt[maxn], S, L;
int ans;
inline void getblock(int l,... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int n, k, mod, num[200005];
void Add(int &a, int b) { ((a += b) >= mod) && (a -= mod); }
int ksm(int a, int b) {
int ans = 1;
while (b) {
if (b & 1) ans = 1ll * ans * a % mod;
a = 1ll * a * a % mod;
b >>= 1;
}
return ans;
}
void dfs(int dep, int l, int r... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &x, T y) {
return (y < x) ? (x = y, 1) : 0;
}
template <typename T>
inline bool chkmax(T &x, T y) {
return (y > x) ? (x = y, 1) : 0;
}
inline int read() {
int x;
char c;
int f = 1;
while ((c = getchar()) != '-' && (c > ... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& p) {
return o << "(" << p.first << "," << p.second << ")";
}
template <class T>
ostream& operator<<(ostream& o, const vector<T>& vc) {
o << "{";
for (const T& v : vc) o << v << ",";
o << "... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long mod = 0;
inline long long pls(long long a, long long b) {
return a + b < mod ? a + b : a + b - mod;
}
inline long long dec(long long a, long long b) {
return a >= b ? a - b : a - b + mod;
}
int len1 = 0, len2 = 0, c1 = 0, c2 = 0;
void dfs(int L, int R, int h) ... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <class T>
int chkmax(T& a, T b) {
if (b > a) {
a = b;
return 1;
}
return 0;
}
template <class T>
int chkmin(T& a, T b) {
if (b < a) {
a = b;
return 1;
}
return 0;
}
template <class iterator>
void output(iterator begin, iterator end, ostr... |
1081_G. Mergesort Strikes Back | Chouti thought about his very first days in competitive programming. When he had just learned to write merge sort, he thought that the merge sort is too slow, so he restricted the maximum depth of recursion and modified the merge sort to the following:
<image>
Chouti found his idea dumb since obviously, this "merge s... | {
"input": [
"3 2 998244353\n",
"9 3 998244353\n",
"3 1 998244353\n",
"9 4 998244353\n"
],
"output": [
"665496236\n",
"449209967\n",
"499122178\n",
"665496237\n"
]
} | {
"input": [
"53812 4 967428361\n",
"7 2 400166453\n",
"75727 16 485722667\n",
"65536 10 802338989\n",
"65535 12 196344479\n",
"5000 4 961162523\n",
"13694 5 579788161\n",
"99999 14 746231791\n",
"14823 8 622667251\n",
"65536 1 262776883\n",
"65535 4 585040979\n",
"1 2 ... | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
inline bool chkmin(T &x, T y) {
return y < x ? x = y, 1 : 0;
}
template <typename T>
inline bool chkmax(T &x, T y) {
return x < y ? x = y, 1 : 0;
}
const int INF = 0x3f3f3f3f;
const int N = 1e5 + 10;
int cnt[N];
int mod;
inline int read() {
int x... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.