Search is not available for this dataset
name stringlengths 2 112 | description stringlengths 29 13k | source int64 1 7 | difficulty int64 0 25 | solution stringlengths 7 983k | language stringclasses 4
values |
|---|---|---|---|---|---|
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<bool> arr(n);
int cnt = 0;
int tmp;
for (int i = int(0); i <= int(n - 1); i++) {
cin >> tmp;
arr[i] = (tmp == 1) ? true : false;
cnt += tmp;
}
if (cnt == n) {
cout << "YES\n";
return 0;
}
bool foun... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int MAX = 100005;
int main() {
bool find, map[MAX];
int step;
int a[MAX], n;
while (cin >> n) {
find = 0;
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 3; i <= n; i++) {
if (n % i == 0 && !find) {
step = n / i;
memset(... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | n = int(input())
lis = list(input().split())
for i in range(len(lis)):
lis[i]=int(lis[i])
m = []
m1 = []
flag = "NO"
for i in range(1, int(n**.5)+1):
if n % i == 0:
m.append(i)
if n//i != i:
m.append(n//i)
p = 0
for i in m:
if i<n/2:
for j in range(i):
... | PYTHON3 |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 |
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.*;
public class Main {
static int n;
static int[] a;
public static void main(String[] args) {
Scanner scanner = new Scanner();
n=scanner.nextInt();
a=new int[n];
for(int i=... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.*;
import java.util.*;
import java.math.*;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class RoundTableKnights {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReade... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 100500;
bool F[N];
int n;
bool check(int q) {
if (n / q <= 2) return false;
for (int i = 0; i < q; i++) {
int t;
for (t = i; t < n; t += q)
if (!F[t]) break;
if (t >= n) return true;
}
return false;
}
int main(int argc, char **argv) {... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.util.*;
import java.io.*;
import java.text.*;
public class C71 {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
PrintWriter pw = new PrintWriter(System.out);
int n = sc.nextInt();
sieve(n);
boolean[] arr = new boolean[n];
for (int i = 0; i < a... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, i, a[100005], x, flag = 0, m, j;
scanf("%d", &n);
for (i = 0; i < n; i++) scanf("%d", &a[i]);
for (i = 1; i <= n / 3; i++) {
if (n % i) continue;
for (j = 0; j < i; j++) {
x = j;
m = 1;
while (x < n + i) {
int y ... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import math
def fact(x):
ans=[]
for i in range(1,int(math.sqrt(x))+1):
if(x%i==0):
if(i==x//i):
ans.append(i)
else:
ans.append(i)
ans.append(x//i)
return ans;
a=int(input())
z=list(map(int,input().split()))
ans=[]
from collectio... | PYTHON3 |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | n = input()
status = map(int, raw_input().split())
frt = False
ors = lambda x, y: x or y
ands = lambda x, y: x and y
b = False
for l in range(1, n/3+1):
if n%l!=0: continue
for i in range(l):
b = True
for j in range(i, n, l):
if status[j] == 0:
b = False; break
... | PYTHON |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
bool isPrime(long long n) {
for (long long i = 2; i * i <= n; i++) {
if (n % i == 0) return false;
}
return true;
}
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long n;
cin >> n;
long long arr[n];
for (long long i = 0; i < n; ... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 3; i <= n; i++) {
if (n % i == 0) {
for (int k = 0; k < n / i; k++) {
int sum = 0;
for (int j = k; j < ... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.*;
import java.util.*;
public class scratch_25 {
static class Reader {
static BufferedReader reader;
static StringTokenizer tokenizer;
/**
* call this method to initialize reader for InputStream
*/
static void init(InputStream input) {
... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 |
import java.util.*;
import java.io.*;
public class RoundTableKnights {
// https://codeforces.com/contest/71/problem/C
public static void main(String[] args) throws IOException, FileNotFoundException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//BufferedReader in = new Buffered... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | def f(n):
n += 1
t = [1] * n
for i in range(3, int(n ** 0.5) + 1, 2):
u, v = i * i, 2 * i
if t[i]: t[u :: v] = [0] * ((n - u - 1) // v + 1)
return [4] + [i for i in range(3, n, 2) if t[i]]
n, t = int(raw_input()), map(int, raw_input().split())
q = [n // i for i in f(n) if n % ... | PYTHON |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.util.*;
import java.io.*;
public class C65C{
static BufferedReader br;
public static void main(String args[])throws Exception{
br=new BufferedReader(new InputStreamReader(System.in));
int n=toInt();
int nm[]=toIntArray();
for(int i=1;i<=n;i++){
int count=0... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int start;
int ara[n];
vector<int> x;
x.push_back(1);
vector<int> sta;
for (int i = 2; 2 * i < n; i++) {
if (n % i == 0) x.push_back(i);
}
bool t = true;
for (int i = 0; i < n; i++) {
cin >> ara[i];
if (ara[i] ... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
bool isprime[100008];
void sieve(int n) {
long long int i, j;
for (i = 3; i <= n; i += 2) isprime[i] = true;
for (i = 3; i <= n; i += 2) {
if (isprime[i]) {
for (j = i * i; j <= n; j += i) {
if (isprime[j]) isprime[j] = false;
}
}
}
isp... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | //package sheet_C;
import java.io.*;
import java.util.*;
public class RoundTableKnights {
public static void main(String[]args)throws Throwable{
PrintWriter pw=new PrintWriter(System.out,true);
MyScanner sc=new MyScanner();
int n=sc.nextInt();
int []a=new int[n];
for(int i=0;i<n;i++)
a[i]=sc.nextInt();
... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n, flag, dp[100001];
int main() {
cin >> n;
for (long long i = 1; i < n + 1; i++) cin >> dp[i];
for (long long i = 3; i < n + 1; i++) {
if (n % i == 0) {
for (long long j = 1; j < n / i + 1; j++) {
flag = 0;
for (int k = j; k < n + 1; k +... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import static java.util.Arrays.*;
import static java.lang.Math.*;
import static java.math.BigInteger.*;
import java.util.*;
import java.math.*;
import java.io.*;
public class C implements Runnable
{
String file = "input";
boolean TEST = false;
void solve() throws IOException
{
int n =... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import sys,os,io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
from math import sqrt
def divisors(n):
ans = []
for i in range (1,int(sqrt(n)+1)):
if not n%i:
ans.append(i)
if n//i != i:
ans.append(n//i)
return ans
n = int(input())
a = [int(i) ... | PYTHON3 |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using llu = unsigned long long;
using ld = long double;
vector<int> dx = {-1, 1, 0, 0};
vector<int> dy = {0, 0, 1, -1};
const double PI = acos(-1.0), g = 9.80665;
const ll unseen = -1, done = -1e17;
const ll inf = 1e18 + 505, ninf = -1e18 - 505;
const ... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import static java.lang.Math.*;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.exit;
import static java.lang.System.arraycopy;
import static java.util.Arrays.sort;
import static java.util.Arrays.binarySearch;
import static java.util.Arrays.fill;
import java.util.*;
import java.io.*;
p... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 |
import java.awt.Point;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
import java.io.*;
import java.math.BigInteger;
import static java.math.BigInteger.*;
import java.util.*;
public class C{
void solve()throws Exception
{
int n=nextInt();
boolean[]a=new boolean[n];
//String s=nextToken();
f... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
bool check(long long int x, long long int arr[], long long int n) {
if (n / x <= 2 && n % x != 0) return false;
for (long long int i = 0; i < x; i++) {
bool f = true;
for (long long int j = i; j < n; j += x) {
if (arr[j] != 1) {
f = false;
... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long Set(long long N, long long pos) { return N = N | (1 << pos); }
long long reset(long long N, long long pos) { return N = N & ~(1 << pos); }
bool check(long long N, long long pos) { return (bool)(N & (1 << pos)); }
void CI(long long &_x) { scanf("%d", &_x); }
void C... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.*;
import java.math.*;
import java.util.*;
import java.awt.geom.*;
import static java.lang.Math.*;
public class Solution implements Runnable{
BufferedReader in;
PrintWriter out;
StringTokenizer st;
private String next() throws ... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class P_71C {
static final FS sc = new FS();
static final PrintWriter pw = new PrintWriter(System.out);
public static void main(String[] args) {
int n = sc.nextInt(... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int a[1000000 + 20];
vector<int> v;
int main() {
int n, d, ans;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i];
}
for (int i = 1; i <= n; i++) {
if (n % i == 0) {
v.push_back(i);
}
}
sort(v.begin(), v.end());
for (int i = 0; i < v.size... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.*;
import java.math.*;
import java.util.*;
public class Solution{
public static void main (String[] args) throws java.lang.Exception
{
Scan sn=new Scan();
Print pr=new Print();
int n = sn.scanInt();
int arr[] = new int[n];
for (int i = 0; i < n; i++) {
... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.util.*;
import java.io.*;
public final class Main {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
for(int i = 0; i<n; i++)
a[i] = sc.nextInt();
for(int i = 1; i<=n; i++) {
... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.*;
import java.util.*;
public class Main {
boolean check(int[] as, int x) {
int s = as.length / x;
for(int i = 0; i < s; ++i) {
boolean ok = true;
for(int j = i; j < as.length; j += s)
if(as[j] == 0)
ok = false;
... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.util.*;
import java.lang.*;
import java.io.*;
public class Codechef
{ static PrintWriter out=new PrintWriter(System.out);static FastScanner in = new FastScanner(System.in);static class FastScanner {BufferedReader br;StringTokenizer stok;FastScanner(InputStream is) {br = new BufferedReader(new InputStr... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.*;
import java.math.*;
import java.util.*;
import static java.lang.Math.*;
public class C65 {
static InputStreamReader inp = new InputStreamReader(System.in);
static BufferedReader in = new BufferedReader(inp);
static boolean test = false;
public String str() throws IOException {
return in.rea... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n, i, a[100003], j, k;
int main() {
scanf("%d", &n);
for (i = 0; i < n; i++) scanf("%d", &a[i]);
for (i = 1; i <= n / 3; i++)
if (n % i == 0) {
for (j = 0; j < i; j++) {
int z = 1;
for (k = j; k < n; k += i) z &= a[k];
if (z) retu... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | from sys import exit
n = int(input())
knights = list(map(int, input().split()))
for divisor in range(1, n+1):
if n % divisor == 0 and divisor < n/2:
vertexes = n // divisor
for i in range(divisor):
count = 0
for j in range(i, n, divisor):
if knights[j] == ... | PYTHON3 |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.OutputStreamWriter;
import java.io.BufferedWriter;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.Writer;
import java.util.List;
import java.io.IOException;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.ArrayList;
import java.util.NoSuchElemen... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int start;
int ara[n];
vector<int> x;
x.push_back(1);
vector<int> sta;
for (int i = 2; 2 * i < n; i++) {
if (n % i == 0) x.push_back(i);
}
bool t = true;
for (int i = 0; i < n; i++) {
cin >> ara[i];
if (ara[i] ... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.Arr... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import re, math
n = raw_input()
knights = [int(k) for k in raw_input().rsplit(' ')]
numbers = []
bad = []
n = len(knights)
result = ""
for i in range(3,n+1):
if n % i == 0 and n-len(bad) >= i:
numbers.append(i)
for i in range(n):
if knights[i] == 0:
bad.append(i)
for k in numbers:
if result == "YES":
bre... | PYTHON |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | //package codeforces;
import java.io.*;
import java.util.Comparator;
import java.util.Objects;
import java.util.StringTokenizer;
import java.util.function.BiFunction;
import java.util.function.Function;
public class RoundTableKnights {
static BiFunction<Integer, Integer, Integer> ADD = (x, y) -> (x + y);
st... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
vector<int> v;
vector<pair<int, int>> ans;
int main() {
int n, k;
cin >> n;
int v[n];
for (int i = 0; i < n; i++) cin >> v[i];
for (k = 1; k <= n / 3; k++) {
if (n % k == 0) {
for (int p = 0; p < k; p++) {
int sum = 0;
for (int i = p; i <... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | from sys import stdin, stdout
raw_input = stdin.readline
n=int(raw_input())
l=map(int,raw_input().split())
f=0
for i in xrange(1,(n/3)+1):
if n%i:
continue
for j in xrange(i):
f1=0
for k in xrange(j,n,i):
if not l[k]:
f1=1
if not f1:
f=1
... | PYTHON |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const double pi = acos(-1);
const int mod = 1e9 + 9;
int main() {
int n;
vector<int> v;
scanf("%d", &n);
int a[N];
for (int i = 1; i <= n; i++) {
if (n % i == 0) v.push_back(i);
}
int idx = -1;
for (int i = 0; i < n; i++) {
sca... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
void fun() {
long long i, j, n, k, ans = 0, x;
cin >> n;
long long a[n];
for (i = 0; i < n; i++) cin >> a[i];
for (i = 3; i <= n; i++) {
if (n % i != 0) continue;
x = n / i;
for (j = 3; j < i; j++) {
if (i % j == 0) break;
}
if (i != j) c... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | def criba(n):
factor=[1 for i in range(n)]
for i in range(2,n):
if factor[i]==1:
for j in range(i,n,i):
factor[j]=i
return factor
n=int(raw_input())
A=[int(x) for x in raw_input().split()]
factor=criba(n+1)
m=n
while(m>1):
f=factor[m]
if f==2:
if n%4==0:
f=4
else:
break
for i in range(n/f):
... | PYTHON |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long N = 3e5 + 5;
vector<int> adj[N], adj1[N];
bool visited[N];
int height[N], val[N], grid[55][55];
void solve() {
int n;
cin >> n;
vector<int> v;
int a[n], strt = -1;
for (int i = 0; i < n; i++) {
cin >> a[i];
if... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n;
int a[1000001];
int d[1000001];
void nhap() {
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
}
}
void xuly() {
for (int i = 1; i <= n / 3; i++) {
if (n % i != 0) continue;
for (int j = 1; j <= i; j++) {
bool ok = true;
... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static boolean fortunate(int[] v) {
int n = v.length, iter = 0;
for (int i = 0; i < n / 3; i++)
if (v[i] == 1)
for (int j = n/3; j >= 1; j--) {
iter = i;
do
iter = (iter ... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class Main {
... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
#pragma optimization_level 3
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx")
using namespace std;
const long long INF = 0x7f7f7f7f7f7f7f7f;
const long long NINF = -INF;
const long long MAXN = 1e+6 + 8;
... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 |
# Author : raj1307 - Raj Singh
# Date : 30.04.2020
from __future__ import division, print_function
import os,sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
from __builtin__ import xrange as range
from future_builtins import ascii, filter, hex, map, oct, zip
def ii(): return int(input())
... | PYTHON |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.util.Scanner;
import java.io.*;
public class p71c {
public static void main(String[] args) throws Exception{
p71cc in = new p71cc(System.in);
int n = in.nextLong();
int[] all = new int[n];
for (int i = 0; i < all.length; i++) {
all[i] = in.nextLong();
... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | def divisors(n):
i = 2
res = set()
tmp = n
while i * i <= n:
while tmp % i == 0:
tmp //= i
res.add(i)
i += 1
if tmp != 1:
res.add(tmp)
if n % 4 == 0:
res.add(4)
res.discard(2)
return res
def main():
n = int(input())
k... | PYTHON3 |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long const M = 1000000007;
double const pi = acos(-1);
long long const inf = 2e18;
long long const N = 200001;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long i, j, t, n, k;
cin >> n;
vector<long long> a(n);
bool ok... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.FilterInputStream;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.File;
import java.util.ArrayList;
import java.io.Inp... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | from sys import stdin
from sys import exit
from math import sqrt
#parser
def parser():
return map(int, stdin.readline().split())
def IsPrime(t):
if t==1 or t==2:
return False
if t==4:
return True
for i in range(2,int(sqrt(t))+1):
if t%i==0:
return False
return T... | PYTHON3 |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | // practice with rainboy
import java.io.*;
import java.util.*;
public class CF71C extends PrintWriter {
CF71C() { super(System.out, true); }
Scanner sc = new Scanner(System.in);
public static void main(String[] $) {
CF71C o = new CF71C(); o.main(); o.flush();
}
int[] aa;
int n;
boolean check(int m) {
for (... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, N;
cin >> n;
N = n;
vector<int> a(n, 0), prs;
for (int& x : a) cin >> x;
if (n % 4 == 0) prs.push_back(4);
for (int i = 2; i * i <= n; ++i) {
if (n % i == 0 && i != 2) prs.push_back(i);
while (n % i == 0) {
n /= i;
}
}
... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int arr[100001];
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int flag = 0;
int cnt;
for (int i = 0; i < n; i++) {
while (arr[i] != 1) i++;
for (int d = 1; d <= n / 3; d++) {
if (n % d != 0) continue;
cnt... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #Code by Sounak, IIESTS
#------------------------------warmup----------------------------
import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
from collections import defaultdict
BUFSIZE = 8192
class FastIO(IOBase):
newlines = 0
def __init__(self, file):
... | PYTHON3 |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
std::vector<long long int> v;
long long int solve(long long int n) {
for (long long int i = 3; i <= n; i++) {
if (n % i != 0) continue;
long long int x = n / i;
long long int flag;
for (long long int k = 0; k < x; k++) {
flag = 1;
for (long lon... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import sys
def divisors(n):
divisors_ = []
for i in range(1, n / 3 + 1):
if n % i == 0:
divisors_.append(i)
return divisors_
def is_lucky(n, knights):
for i in divisors(n):
for j in range(i):
lucky = True
while j < len(knights):
if knights[j] == 1:
j += i
else:
lucky =... | PYTHON |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.*;
public class Solution {
public static void main(String[] args) {
FastScanner sc = new FastScanner();
int t=1;
while(t-->0){
int... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[n + 1];
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i <= n / 3; i++) {
if (n % i == 0) {
for (int j = 1; j <= i; j++) {
int z = 1;
for (int k = j; k < n; k += i) {
if (a[k] == 0)... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.util.*;
import java.io.*;
public class RoundTableKnights
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
int n = in.nextInt();
boolean[] knights = new boolean[n];
for(int x = 0; x < n; x++)
{
if(in.nextInt() == 1)
{
knights[x] = true;
}
}
... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < n; i++) cin >> a[i];
bool flag = false;
vector<int> b;
for (int p = 3; p < n + 1; p++) {
if (n % p == 0) {
b.resize(n / p);
for (int i = 0; i < n / p; i++) {
b[i] = 0;
... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import javafx.util.Pair;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.lang.reflect.Array;
import java.util.ArrayList;
impo... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
long long n;
cin >> n;
vector<long long> a(n + 1), factor;
for (long long i = 1; i <= n; i++) cin >> a[i];
factor.push_back(1);
for (long long i = 2; i <= sqrt(n); i++) {
if (n... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import sys
n = int(sys.stdin.readline())
v = [int(i) for i in sys.stdin.readline().strip().split()]
ok = False
for i in range(3, n+1):
if n%i == 0:
for j in range(n/i):
ok = True
for k in range(0, n, n/i):
if v[(j+k)%n] == 0:
ok = False
... | PYTHON |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Locale;
import java.util.StringTokenizer;
public class Main {
void solve() throws IOException {
int n = nextInt();
boolean[] x = new boolean[n * 2];
... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.*;
import java.util.StringTokenizer;
public class Q71C implements Runnable{
private void solve() throws IOException {
int n = nextInt() ;
boolean[] state = new boolean[n];
for(int i=0;i<n;i++){
state[i] = (nextInt()==1);
}
for(int i = 1;i<=(n/3);i... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.util.ArrayList;
import java.util.Scanner;
public class RoundTableKnight {
public static void main(String...Args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
Boolean flag = true;
ArrayList<Boolean> table = new ArrayList<Boolean>();
for (int i =0;i<... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.*;
import java.util.*;
public class RoundTableKnights {
public static void main(String[] args) throws IOException {
BufferedReader f = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(f.readLine());
boolean[] a = new boolean[n];
StringTok... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | R = lambda: map(int, input().split())
n = int(input())
arr = list(R()) * 2
visited = [0] * (n + 1)
for ne in range(3, n + 1):
if n % ne == 0 and not visited[ne]:
g = n // ne
if any(all(arr[i:i + g * (ne - 1) + 1:g]) for i in range(g)):
print('YES')
exit(0)
i = ne
... | PYTHON3 |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, dummy, count = 0;
cin >> n;
vector<int> v, arr;
for (int i = 0; i < n; i++) {
cin >> dummy;
if (dummy == 1) count++;
arr.push_back(dummy);
}
if (count == n) {
cout << "YES";
return 0;
}
v.push_back(1);
for (int i = 2... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int main() {
int n;
cin >> n;
vector<int> a(n);
for (int i = 0; i < int((a).size()); i++) cin >> a[i];
for (int i = 3; i <= n; ++i)
if (n % i == 0)
for (int t = 0; t < n; ++t) {
bool tf = true;
for (int j =... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
bool compare(const long long &a, const long long &b) { return a > b; }
long long binpow(long long a, long long b) {
if (b == 0) return 1;
if (b == 1) return a;
if (b % 2 == 0) return binpow(a, b / 2) * binpow(a, b / 2);
return a * binpow... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | amount = int(input())
r = input().split()
r = [int(i) for i in r]
result = False
for i in range(3, amount+1):
if amount % i != 0:
continue
for j in range(int(amount/i)):
tmp = 0
for k in range(i):
if r[j+k*int(amount/i)] == 1:
tmp += 1
else:
... | PYTHON3 |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | /**
* Created by IntelliJ IDEA.
* User: aircube
* Date: 31.03.11
* Time: 23:46
* To change this template use File | Settings | File Templates.
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public clas... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import javafx.util.Pair;
import java.io.*;
import java.math.*;
import java.util.*;
@SuppressWarnings("Duplicates")
// author @mdazmat9
public class Main{
static Scanner sc = new Scanner(System.in);
static PrintWriter out = new PrintWriter(System.out);
public static void main(String[] args) throws IOExcept... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 |
import java.io.*;
import java.util.*;
import static java.lang.Math.*;
public class BetaRound65_C implements Runnable {
final boolean ONLINE_JUDGE = System.getProperty("ONLINE_JUDGE") != null;
BufferedReader in;
PrintWriter out;
StringTokenizer tok = new StringTokenizer("");
void init() throws IOException {
i... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 200015;
const int MOD = 1000000007;
int a[MAXN];
bool F(int len, int num) {
bool flag;
int pres;
for (int i = 0; i <= num - 1; i++) {
flag = true;
pres = i;
for (int j = 0; j <= len - 1; j++) {
if (a[pres] == 0) flag = false;
p... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double EPS = 1e-11;
void fast() { std::ios_base::sync_with_stdio(0); }
int n;
vector<int> arr;
void check(int x) {
if (n / x < 3) return;
for (int i = 0; i < x; i++) {
bool ok = true;
for (int j = i; j < n; j += x) ok &= arr[j... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | n=int(input())
lst=[*map(int,input().split())]
from sys import exit
for i in range(3,n+1):
if n%i==0:
k=n//i
for j in range(k):
res='YES'
for x in range(j,n,k):
if lst[x]==0:res='NO';break
if res=='YES':print(res);exit()
print('NO') | PYTHON3 |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import math;
n = input();
a = list(map(int,raw_input().split()));
td = set();
for i in range(2,int(math.sqrt(n))+10):
if n%i == 0:
td.add(i);
td.add(n//i);
td.add(n);
divisior = sorted(list(td));
while len(divisior)>0 and divisior[0]<3:
divisior.pop(0);
for p in divisior:
d = n//p;
for i in range(0,d):
ok = T... | PYTHON |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.StringTokenizer;
public class RoundTableKnights {
static boolean isPrime(int n) {
for(int i=2;i<n;i++) {
if(n%i==0) {
return false;
}
}
return true;
}
public s... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
bool is_prime(int n) {
if (n < 2) return false;
if (n < 4) return true;
if (n % 2 == 0 || n % 3 == 0) return false;
if (n < 25) return true;
for (int i = 5; i * i <= n; i += 6)
if (n % i == 0 || n % (i + 2) == 0) return false;
return true;
}
int main() {
i... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | /*Author: Satyajeet Singh, Delhi Technological University*/
import java.io.*;
import java.util.*;
import java.text.*;
import java.lang.*;
public class Main {
/*********************************************Constants******************************************/
static PrintWriter out=new PrintWriter(new OutputStreamWr... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
vector<long long> a;
long long N;
bool is_Polygon(long long M) {
for (int i = 0; i < M; ++i) {
long long st = i;
bool flag = 0;
while (st < N) {
if (a[st] == 0) {
flag = 1;
break;
}
st += M;
}
if (flag == 0) {
re... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
int n, i, j, k;
int a[100005];
int p[1005], enp;
int tmp1;
bool chk;
int main() {
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
tmp1 = n;
i = 2;
enp = 0;
while (i * i <= tmp1) {
if (tmp1 % i == 0) {
p[enp] = i;
enp++;
... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100 * 1000 + 100;
int n;
bool p[maxn];
vector<int> m;
void div(int tmp);
bool chk(int st, int r);
int main() {
ios ::sync_with_stdio(false);
cin.tie(0);
cin >> n;
for (int i = 0; i < n; i++) cin >> p[i];
div(n);
for (int i = 0; i < m.size(); i++... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.*;
public class Solution {
private final static FastReader in = new FastReader();
private static final PrintWriter out = new PrintWriter(System... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import math
n=int(input())
a=[int(i) for i in input().split()]
isDone=False
for i in range(3,n+1):
if n%i==0:
k=n//i
for z in range(0,k):
isDone=True
s=z
while s<n:
if a[s]==0:
isDone=False
break
... | PYTHON3 |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cout << "[" << *it << ": " << a << "]\t";
err(++it, args...);
}
const long long nax = 1e5 + 5;
long long a[nax];
long long n;
bool... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
long long x, y, z;
deque<long long> q, p;
int main() {
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
;
scanf("%lld", &x);
for (int i = 0; i < x; i++) {
scanf("%lld", &y);
q.push_back(y);
}
for (int i = 1; i <= sqrt(x); i++) {
if (x % i == 0) {
... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | import java.io.*;
import static java.lang.Math.*;
import java.lang.reflect.Array;
import java.util.*;
import java.util.function.*;
import java.lang.*;
public class Main {
final static boolean debug = false;
final static String fileName = "";
final static boolean useFiles = false;
public static void m... | JAVA |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | #include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++) cin >> a[i];
int c;
string ans = "NO";
for (int v = n; v >= 3; v--) {
if ((n - v) % v == 0) ... | CPP |
71_C. Round Table Knights | There are n knights sitting at the Round Table at an equal distance from each other. Each of them is either in a good or in a bad mood.
Merlin, the wizard predicted to King Arthur that the next month will turn out to be particularly fortunate if the regular polygon can be found. On all vertices of the polygon knights ... | 2 | 9 | def solve():
m = n = int(raw_input())
a = [int(x) for x in raw_input().strip().split()]
for p in xrange(3, n+1):
if (n % p == 0):
step = n / p
else:
continue
for st in xrange(step):
i = st
while (i < n and a[i]):
i += st... | PYTHON |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.