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 |
|---|---|---|---|---|---|---|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if (!b) return a;
return gcd(b, a % b);
}
int main() {
int p, q;
cin >> p >> q;
cout << q / gcd(p, q) << endl;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
struct UnionFind {
vector<int> v;
UnionFind(int n) : v(n) {
for (int i = 0; i < n; i++) v[i] = i;
}
int find(int x) { return v[x] == x ? x : v[x] = find(v[x]); }
void unite(int x, int y) { v[find(... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | import math
p = int(input())
q = int(input())
print(int(q/(math.gcd(p,q))))
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
int gcd(int p, int q) {
if (!q) return p;
if (q > p) return gcd(q, p);
return gcd(q, p % q);
}
int main(void) {
int p, q;
scanf("%d%d", &p, &q);
int g = gcd(p, q);
p /= g;
q /= g;
int b = 1;
for (int i = 2; q - 1; i++)
if (!(q % i)) {
b *= i;
while (!(q % i))... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>??
using namespace std;??
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const double EPS = 1e-7;
const int inf = 1e9;
const long long INF = 2e18;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
int main() {
long long a, b;
cin >>... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
int gcd(int u, int v) {
while (v != 0) {
int r = u % v;
u = v;
v = r;
}
return u;
}
int main() {
int p, q;
cin >> p >> q;
q /= gcd(p, q);
int ans = q;
for (int i = 2, nroot = q; nroot > 1; i++) {
nroot = pow(q, 1 / (d... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
inline int toInt(string s) {
int v;
istringstream sin(s);
sin >> v;
return v;
}
template <class T>
inline string toStr(T x) {
ostringstream sout;
sout << x;
return sout.str();
}
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = INT_MAX / ... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
uint32_t gcd(uint32_t p, uint32_t q) {
if (q > p) return gcd(q, p);
if (q == 0)
return p;
else
return gcd(q, p % q);
}
pair<uint32_t, uint32_t> nth_root(uint32_t n) {
for (uint32_t i = 2; i <= n; i++) {
uint32_t tmp = n;
uint32_t count = 0;
while... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
uint32_t gcd(uint32_t a, uint32_t b) {
if (b > a) return gcd(b, a);
if (b == 0) return a;
return gcd(b, a % b);
}
int32_t main() {
uint64_t p, q;
cin >> p >> q;
uint64_t g = gcd(p, q);
p /= g;
q /= g;
for (uint64_t i = 2; i <= (uint64_t)sqrt(q); i++) {
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
int main()
{
ll p,q;
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
bool is_prime(int n) {
if (n == 2) return true;
if (n < 2 || n % 2 == 0) return false;
for (int i = 2; i * i <= n; i += 2) {
if (n % i == 0) return false;
}
return true;
}
int main() {
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
long long p,q;
cin >> p >> q;
int va=q;
int ans=0;
for(long long i=2;i*i<=va;i++){
if(ans!=0)
break;
if(q%i==0){
ans=-1;
while(q%i==0){
q/=i;
//cout << q << endl;
}
if(q==1)
ans=i;
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::endl;
int gcd(int n, int m) {
if (n % m == 0) {
return m;
} else {
return gcd(m, n % m);
}
}
int main(void) {
int p, q;
cin >> p >> q;
int n = q;
int m = p;
int l = gcd(n, m);
while (l != 1) {
n = n / l;
m = m / l;
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int q,p,t,ans=1,i,j,c;
cin>>q>>p;t=p;
p/=__gcd(q,p);
for(i=2;i<=t;i++){
if(p%i==0){
p/=i;
ans*=i;
i--;
}
}
cout<<ans<<endl;
} |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
long long int gcd(long long int l, long long int r) {
if (l > r)
return gcd(r, l);
else {
if (r % l) {
return gcd(l, r % l);
} else {
return l;
}
}
}
map<long long int, int> soinnsuu(long long int a) {
map<... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int p,q,t,ans=1,num;
set<int> s;
cin>>p>>q;
num=t=q/__gcd(p,q);
for(int i=2;i<t;i++)
while(!(num%i))s.insert(i),num/=i;
set<int>::iterator ite=s.begin();
while(ite!=s.end())ans*=*ite,ite++;
if(ans==1)ans=t;
cout<<ans<<endl;
return 0;
} |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if (a % b == 0) return b;
return gcd(b, a % b);
}
int main() {
int p, q;
cin >> p >> q;
cout << q / gcd(q, p) << endl;
return 0;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.util.*;
public class Main{
public static void main(String args[]){
try(Scanner sc = new Scanner(System.in)){
long p = sc.nextLong(), q = sc.nextLong();
long memo = q/gcd(p,q);
long ans = memo;
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int p, q;
vector<int> primes;
const int MA = 20000000;
bool t[MA * 2];
void eratosu() {
t[1] = 1;
for (int i = 2; i <= MA; i++) {
if (t[i] == 0) {
primes.push_back(i);
for (int j = i * 2; j <= MA; j += i) t[j] = 1;
}
}
}
int main() {
eratosu();
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const double EPS = 1e-8;
const int inf = 1 << 30;
int gcd(int a, int b) { return (b == 0 ? a : gcd(b, a % b)); }
int main() {
int a, b;
cin >> a >> b;
cout << b / gcd(a, b) << endl;
}
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | import math
p = int(input())
q = int(input())
print(b/(math.gcd(p,q)))
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long solve(long long a, long long b) {
long long x = max(a, b), y = min(a, b);
if (x % y == 0)
return y;
else
return solve(x % y, y);
}
int main() {
long long p, q, r, ans;
vector<long long> prime(100000);
cin >> p >> q;
r = solve(p, q);
p /= r;... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
const int MOD = 1000000007;
const int INF = 1000000000;
using namespace std;
const double eps = 1e-9;
const int inf = 1e9;
struct Point {
double x, y;
Point() {
x = 0;
y = 0;
}
Point(double d_x, double d_y) { x = d_x, y = d_y; }
double operator*(Point obj) { return obj.x * x +... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.util.*;
public class Main{
public static void main(String args[]){
try(Scanner sc = new Scanner(System.in)){
long p = sc.nextLong(), q = sc.nextLong();
long memo = q/gcd(p,q);
long ans = memo;
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
int main() {
long long int a, b;
cin >> a >> b;
long long int c = b / gcd(a, b);
long long int ans = 1;
for (long long int i = 2; i <= c; i++) {
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | import math
def main():
p = int(input())
q = int(input())
print(int(q/math.gcd(p,q)))
main()
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
int gcd(int a, int b) {
int t;
while (b) {
t = a % b;
a = b;
b = t;
}
return a;
}
int main(void) {
int p, q, i, j, ans = 1, bef = 0;
scanf("%d%d", &p, &q);
q /= gcd(p, q);
for (i = 2; i < sqrt(q);) {
if (!(q % i)) {
if (bef != i) ans *= i;
q /= i;
... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
long long p, q;
cin >> p >> q;
q = q / __gcd(p, q);
int ans = 1;
for (int i = 2; i <= q; i++) {
if (q % i == 0) {
q /= i;
ans *= i;
while (q % i =... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
int root(int a) {
int b = sqrt(a);
if (b != sqrt(a))
return a;
else
return root(b);
}
int main() {
int p, q;
cin >> p >> q;
int tmp = gcd(q, p);
p /= tmp;
q /= tmp;
q = root(... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll p, q;
while (cin >> p >> q) {
ll ans = 1;
for (int i = 2; i <= 1e5; ++i) {
int c = 0;
while (p % i == 0) p /= i, ++c;
while (q % i == 0) q /= i, --c;
if (c < 0) ans *= i;
}
cout << ans << endl... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<iostream>
using namespace std;
int main(){
int p, q;
cin >> p >> q;
cout << q/__gcd(p, q) << endl;
} |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
signed main(void) {
int p, q;
cin >> p >> q;
int r = gcd(p, q);
p /= r;
q /= r;
int tmp = q;
set<int> s;
long long a = 2;
while (q >= a * a) {
if (q % a == 0) {
s.insert(a);
q /= ... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
struct UnionFind {
vector<int> v;
UnionFind(int n) : v(n) {
for (int i = 0; i < n; i++) v[i] = i;
}
int find(int x) { return v[x] == x ? x : v[x] = find(v[x]); }
void unite(int x, int y) { v[find(... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | from math import gcd
p,q=[int(i) for i in input().split()]
g = gcd(p,q)
q//=g
print(q)
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
uint32_t gcd(uint32_t p, uint32_t q) {
if (q > p) return gcd(q, p);
if (q == 0)
return p;
else
return gcd(q, p % q);
}
pair<uint32_t, uint32_t> nth_root(uint32_t n) {
for (uint32_t i = 2; i <= (uint32_t)sqrt(n); i++) {
uint32_t tmp = n;
uint32_t coun... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int p, q;
vector<int> primes;
const int MA = 30000000;
bool t[MA * 2];
void eratosu() {
t[1] = 1;
for (int i = 2; i <= MA; i++) {
if (t[i] == 0) {
primes.push_back(i);
for (int j = i * 2; j <= MA; j += i) t[j] = 1;
}
}
}
int gcd(int a, int b) {
i... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | import math
p = int(input())
q = int(input())
print(q/(math.gcd(p,q)))
|
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long p, q;
cin >> p >> q;
for (long long i = 2; i * i <= q; i++) {
if (p % i == 0 && q % i == 0) {
do {
p /= i;
q /= i;
} while (p % i == 0 && q % i == 0);
}
}
for (long long i = 2; i * i <= q; i++) {
if ((... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int q,p,t,ans=1,i,j,c;
cin>>q>>p;t=p;
p/=__gcd(q,p);
for(i=2;i*i<=t;i++){
if(p%i==0){
p/=i;
ans*=i;
i--;
}
}
cout<<ans<<endl;
} |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9;
const long long mod = 1e9 + 7;
long long gcd(long long a, long long b) {
if (b == 0) return a;
return gcd(b, a % b);
}
bool check(long long q, long long i) {
while (q % i == 0) {
q /= i;
if (q == 1) {
return true;
}
}
r... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;
double EPS = 1e-8;
const double PI = acos(-1);
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
long long p, q;
cin >> p >> q;
long long a = q /... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int P, Q;
bool p[1000000];
vector<int> v;
long long solve() {
long long ans = 1;
for (int i = ((int)0); i < ((int)v.size()); i++)
if (Q % v[i] == 0) ans *= v[i];
return ans;
}
int main(void) {
for (int i = ((int)0); i < ((int)1000000); i++) p[i] = true;
p[0] =... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int P, Q;
bool p[100000];
vector<int> v;
int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
long long solve() {
long long ans = 1;
for (int i = ((int)0); i < ((int)v.size()); i++)
if (Q % v[i] == 0) ans *= v[i];
if (ans == 1) ans *= Q;
ret... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int P, Q;
int solve() {
int b = 2;
while (1) {
int n = P % Q;
for (int j = ((int)0); j < ((int)b * 10); j++) {
int s = n * b / Q;
n = n * b - Q * s;
if (n == 0) break;
}
if (n == 0) break;
b++;
}
return b;
}
int main(void) {
c... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long p, q;
int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
int main() {
cin >> p >> q;
long long r = gcd(p, q);
p /= r;
q /= r;
for (int i = 2; i * i <= q; i++) {
int D = 1;
if (q == i) continue;
while (true) {
D *=... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
while (1) {
int stat = 0;
for (int i = 2; i <= sqrt(max(a, b)); i++) {
if (a % i == 0 && b % i == 0) {
stat = 1;
a /= i;
b /= i;
break;
}
}
if (stat == 0) break;
}
if... |
p01809 Let's Solve Geometric Problems | Let's solve the geometric problem
Mr. A is still solving geometric problems today. It is important to be aware of floating point errors when solving geometric problems.
Floating-point error is the error caused by the rounding that occurs when representing a number in binary finite decimal numbers. For example, 0.1 in... | {
"input": [
"1 2"
],
"output": [
"2"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
bool isPrime(int x){
for(int i=2;i*i<=x;i++) if(x%i==0) return false;
return true;
}
int main(){
int p,q,i,j,k;
cin>>p>>q;
k=q/__gcd(p,q);
j=1;
for(i=2;i*i<=k;i++){
if(!isPrime(i)) continue;
j*=i;
while(k%i==0) k/=i;
}
cout << j*k << endl;
ret... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()
// code starts
#define MOD 1000000007
int main()
{
ll n,m,k;cin>>n>>m>>k;
vector<int> p(m);
ll i,j,l;
rep(i,m)cin>>p[i];
ll num=1;
ll needs=0;
while(num<=k)
{... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll dp[50][1000];
ll ans[1000];
ll M=1e9+7;
int main(){
ll n,m,K,p[10000];
cin>>n>>m>>K;
dp[0][0]++;
for(int i=0;i<m;i++)cin>>p[i],dp[0][p[i]%n]++;
ll i=0;
ans[0]=1;
while((1<<i)<=K){
if((1<<i)&K){
ll tmp[1000]={}... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
/* S.size() s.substr(l,r=s.size()-l) -> l文字目からr文字分
__gcd() lower_bound(a+l,a+r,x)-a でindex
// 配列 -> min/max({})
// vector-> *min_element(a+l,a+r) *忘れず lとrで[l,r)
//reverse(a+l,a+r) 配列aの[l,r)を逆順に strはreverse(all(s))
//sort(a+l,a+r,greater <int>()) 配列aの[l,r)昇順sort,大きい順はgreater<type>()
//vect... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <utility>
#include <vector>
#define R... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 100000... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | java | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class Main {
static InputStream is;
static PrintWriter out;
static String INPUT = "";
static void solve()
{
int n = ... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <iostream>
#include <vector>
using namespace std;
const long long p = 1000000007;
void printmat(const vector< int > &a)
{
const int n = a.size();
for(int i = 0; i < n; i++) {
for(int j = 0; j < n; j++) {
cerr << a[(i+n-j)%n] << " ";
}
cerr << endl;
}
}
// caution: b = a * b
void mulB... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
vector<ll> solve(vector<ll> a,vector<ll> b,ll m) {
vector<ll> c(m,0);
for(int i=0; i<m; i++) {
for(int j=0; j<m; j++) {
c[(i+j)%m]+=a[i]*b[j];
c[(i+j)%m]%=mod;
}
}
return c;
}
vector<ll> mod_pow(ve... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//--------------------------------------------------... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef vector<ll> row;
typedef vector<row> mat;
ll N, M, K, P[10000];
row mul(row &A, row &B) {
row C(N);
REP(i, 0, N)
REP(j, 0, N)
C[i] = (C[i] + A[... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
using ll = long long;
const ll mod = 1e9+7;
using vl = vector<ll>;
using mat = vector<ll>;
mat mul(const mat &a, const mat &b)
{
int n = a.size();
mat c(n);
rep(i,n)
{
c[i] = 0;
rep(j,n)... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | // need
#include <iostream>
#include <algorithm>
// data structure
#include <bitset>
//#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <array>
//#include <tuple>
//#include <unordered_map>
#include <unordered_set>
#include ... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
mat mul(mat &A,mat &B){
mat C(A.size(),vec(B[0].size()));
for(int i=0;i<A.size();i++){
for(int k=0;k<B.size();k++){
for(int j=0;j<B[0].size();j+... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).be... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto (a): (b))
#define all(v) (v).begin... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define MOD 1000000007
typedef vector<int> vec;
vec calc(vec a,vec b){
int n=a.size();
vec res(n,0);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
res[(i+j)%n]+=a[i]*b[j];
res[(i+j)%n]%=MOD;
}
}
return res;
}
signed main(){
... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <iomanip>
#include <functional>
#include <bitset>
#include <limits>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <ra... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef vector<ll> row;
typedef vector<row> mat;
ll N, M, K, P[10000];
row mul(row &A, row &B) {
row C(N);
REP(i, 0, N)
REP(j, 0, N)
C[i] = (C[i] + A[... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <string>
#include <vector>
using usize = std::size_t;
using u64 = std::uint64_t;
static constexpr u64 mod = 1000000007;
int main() {
usize n, m;
std::cin >> n >> m;
u64 k;
std::cin >> k;
const auto mul = [&](std::vecto... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <utility>
#include <vector>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) begin(v),end(v)
#define fi first
#define se second
template<typename A, typename B> inline bool ... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf = 1e9;
ll mod = 1e9+7;
int main(){
ll n,m,kk;
cin>>n>>m>>kk;
vector<vector<ll> > dp(32, vector<ll>(n,0) );
dp[0][0]++;
for(ll i=0;i<m;i++){
ll tmp;
cin>>tmp;
//tmp--;
dp[0][tmp%n]++;
}
for(ll i=1;i<32;... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | /* -*- coding: utf-8 -*-
*
* 2844.cc: Almost Infinite Glico
*/
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll,ll>;
const ll LINF = 0x1fffffffffffffff;
const ll MOD = 1000000007;
#define name3(_1,_2,_3,name,...) name
#define rep1(n) for(ll i=0;i<(n);++i)
#define rep2(i,n) for(ll i=0;i<(n);++i)
#define rep3(i,a,b) for(ll i=(a);i<(b);++i)
#def... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; i++ )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typede... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define MOD 1000000007
typedef vector<int> vec;
vec calc(vec a,vec b){
int n=a.size();
vec res(n,0);
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
res[(i+j)%n]+=a[i]*b[j];
res[(i+j)%n]%=MOD;
}
}
return res;
}
signed main(){
... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#pragma GCC optimize("-O3")
using namespace std;
void _main();
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
_main();
}
int mod = 1000000007;
int add(int x, int y) { return (x += y) >= mod ? x - mod : x; }
template <class... T>
int add(int x, T... y) {
return add(x, add(y...));
... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long inf = 1 << 29;
vector<vector<long long> > mul(vector<vector<long long> > A,
vector<vector<long long> > B) {
vector<vector<long long> > C(A.size(), vector<long long>(B[0].size()));
for (int i =... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
using vl = vector<ll>;
using mat = vector<vl>;
mat mul(const mat &a, const mat &b) {
int n = a.size();
mat c(n, vl(n));
for (int(i) = 0; (i) < (int)(n); ++(i))
for (int(j) = 0; (j) < (int)(n); ++(j))
for (int(k) ... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
public class Main {
static InputStream is;
static PrintWriter out;
static String INPUT = "";
static void solve()
{
int n = ... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long longinf = 1LL << 60;
const long long mod = 1e9 + 7;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int sz;
vector<long long> mul(vector<long long> A, vector<long long> B) {
vector<long long> C(sz);
for (int i = (int)0; i < (in... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long dp[50][1000];
long long ans[1000];
long long M = 1e9 + 7;
int main() {
long long n, m, K, p[10000];
cin >> n >> m >> K;
dp[0][0]++;
for (int i = 0; i < m; i++) cin >> p[i], dp[0][p[i] % n]++;
long long i = 0;
ans[0] = 1;
while ((1 << i) <= K) {
i... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
vector<vector<long long> > mul(vector<vector<long long> > &A,
vector<vector<long long> > &B) {
vector<vector<long long> > C(A.size(), vector<long long>(B[0].size()));
for (int i = 0; i < A.size(); i++) {
for (int k = 0; k < B.size(); k... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#pragma GCC optimize("-O3")
using namespace std;
void _main();
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
_main();
}
int mod = 1000000007;
int add(int x, int y) { return (x += y) >= mod ? x - mod : x; }
template <class... T>
int add(int x, T... y) {
return add(x, add(y...));
... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int N, M;
long long int table[10000];
vector<vector<long long int> > calc_ans(vector<vector<long long int> > left,
vector<vector<long long int> > right) {
vector<vector<long long int> > RET(1, vector<long long int>(N));
for (int c... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int mod = 1000000007;
struct Mod {
public:
int num;
Mod() : Mod(0) { ; }
Mod(long long int n) : num((n % mod + mod) % mod) {
static_assert(mod < INT_MAX / 2,
"mod is too big, please make num 'long long int' ... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
struct Matrix {
int N;
vector<vector<long long> > a;
Matrix(int n) {
N = n;
a = vector<vector<long long> >(N, vector<long long>(N));
for (int i = 0; i < N; i++) a[i][i] = 1;
}
Matrix pow(long long b) const {
Matrix res(... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1000000007;
struct mint {
ll x;
mint() : x(0) {}
mint(ll x) : x((x % MOD + MOD) % MOD) {}
mint operator+=(const mint& a) {
if ((x += a.x) >= MOD) x -= MOD;
return *this;
}
mint operator-=(const mint& a) {
if ((x ... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
long long MOD(long long a) {
if (a >= 0) {
return a % (long long)(1e9 + 7);
} else {
return (long long)(1e9 + 7) + a % (long long)(1e9 + 7);
}
}
long long digit_count(long long n) {
long long ans;
for (ans = -1; n != 0; ans++) {
n >>= 1;
}
return ans;
}
long long remov... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
template <typename T>
void MACRO_VAR_Scan(T& t) {
std::cin >> t;
}
template <typename First, typename... Rest>
void MACRO_VAR_Scan(First& first, Rest&... rest) {
std::cin >> first;
MACRO_VAR_Scan(rest...);
}
template <typename T>
void MACRO_VEC_ROW_Init(int n, T& t) {
t.resize(n);
}
tem... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int mod = 1000000007;
struct Mod {
public:
int num;
Mod() : Mod(0) { ; }
Mod(long long int n) : num((n % mod + mod) % mod) {
static_assert(mod < INT_MAX / 2,
"mod is too big, please make num 'long long int' ... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long p = 1000000007;
void printmat(const vector<vector<int> > &a) {
const int n = a.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cerr << a[i][j] << " ";
}
cerr << endl;
}
}
void mulBy(const vector<vector<int> > &a, v... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long p = 1000000007;
void printmat(const vector<int> &a) {
const int n = a.size();
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cerr << a[(i + n - j) % n] << " ";
}
cerr << endl;
}
}
void mulBy(const vector<int> &a, vector<i... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
int main() { return 0; }
|
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
const int mod = 1000000007;
struct Mod {
public:
int num;
Mod() : Mod(0) { ; }
Mod(long long int n) : num((n % mod + mod) % mod) {
static_assert(mod < INT_MAX / 2,
"mod is too big, please make num 'long long int' ... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#pragma GCC optimize("-O3")
using namespace std;
void _main();
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
_main();
}
int mod = 1000000007;
int add(int x, int y) { return (x += y) >= mod ? x - mod : x; }
template <class... T>
int add(int x, T... y) {
return add(x, add(y...));
... |
p01944 Almost Infinite Glico | G: Almost Infinite Glico
problem
There is a field where N squares are arranged in a ring. The i-th (1 \ leq i \ leq N-1) cell is ahead of the i + 1th cell. However, if i = N, the next cell is the first cell.
The first cell you are in is the first cell. From there, play rock-paper-scissors K times in a row according ... | {
"input": [
"10 3 2\n3\n6\n6"
],
"output": [
"1\n0\n4\n2\n0\n0\n5\n0\n0\n4"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long longinf = 1LL << 60;
const long long mod = 1e9 + 7;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int sz;
vector<vector<long long> > mul(vector<vector<long long> > A,
vector<vector<long long> > B) {... |
p02093 Invariant Tree | F: Invariant Tree
Problem Statement
You have a permutation p_1, p_2, ... , p_N of integers from 1 to N. You also have vertices numbered 1 through N. Find the number of trees while satisfying the following condition. Here, two trees T and T' are different if and only if there is a pair of vertices where T has an edge ... | {
"input": [
"4\n2 1 4 3"
],
"output": [
"4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
template <typename T> bool chkmax(T &x,T y){return x<y?x=y,true:false;}
template <typena... |
p02093 Invariant Tree | F: Invariant Tree
Problem Statement
You have a permutation p_1, p_2, ... , p_N of integers from 1 to N. You also have vertices numbered 1 through N. Find the number of trees while satisfying the following condition. Here, two trees T and T' are different if and only if there is a pair of vertices where T has an edge ... | {
"input": [
"4\n2 1 4 3"
],
"output": [
"4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<bits/stdc++.h>
typedef long long i64;
const int N=3e5+10,mod=998244353;
int n,ans,p[N],cnt[N],vis[N];
int length(int u){vis[u]=1;return vis[p[u]]?1:length(p[u])+1;}
inline int fpow(int a,int b){int s=1;for(;b;b>>=1,a=(i64)a*a%mod)if(b&1)s=(i64)s*a%mod;return s;}
int main(){
scanf("%d",&n);
for(int i=1;i<=n;i... |
p02093 Invariant Tree | F: Invariant Tree
Problem Statement
You have a permutation p_1, p_2, ... , p_N of integers from 1 to N. You also have vertices numbered 1 through N. Find the number of trees while satisfying the following condition. Here, two trees T and T' are different if and only if there is a pair of vertices where T has an edge ... | {
"input": [
"4\n2 1 4 3"
],
"output": [
"4"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#define ll long long
#define maxn 300005 /*rem*/
#define mod 998244353
#define db double
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define pi pair<int, int>
#define fi first
#define se second
using namespace std;
ll ksm(ll a, ll b) {
if (!b) return 1;
ll ns = ksm(a,... |
p02226 Test | test
UnionFind(バイナリ入力)
Example
Input
Output | {
"input": [
""
],
"output": [
""
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <algorithm>
#include <cassert>
#include <cstdio>
#include <iostream>
#include <limits>
#include <random>
#include <utility>
#include <vector>
namespace procon {
class UnionFind {
private:
struct nodeinfo {
int par;
int rank;
nodeinfo(int par) : par(par), rank(0) {}
};
std::vector<nodeinfo> n... |
p02226 Test | test
UnionFind(バイナリ入力)
Example
Input
Output | {
"input": [
""
],
"output": [
""
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
signed main(){
vector<int> v(10);
for(int i=0;i<10;i++) cin>>v[i];
sort(v.rbegin(),v.rend());
for(int i=0;i<3;i++) cout<<v[i]<<endl;
return 0;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.