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 |
|---|---|---|---|---|---|---|
p00926 Shopping | Example
Input
10 3
3 7
8 9
2 5
Output
23 | {
"input": [
"10 3\n3 7\n8 9\n2 5"
],
"output": [
"23"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long INF = 1107110711071107;
long long N, m;
vector<pair<long long, long long> > d;
long long dp[501][501][1001];
long long dfs(long long pre, long long now, long long n) {
if (n == m) {
return (now - pre + (N + 1) - pre);
}
long long ret = dfs(pre, d[n... |
p00926 Shopping | Example
Input
10 3
3 7
8 9
2 5
Output
23 | {
"input": [
"10 3\n3 7\n8 9\n2 5"
],
"output": [
"23"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int dx[8] = {1, 0, 0, -1, 1, 1, -1, -1};
int dy[8] = {0, -1, 1, 0, -1, 1, -1, 1};
long long gcd(long long a, long long b) {
if (b == 0)
return a;
else
return gcd(b, a % b);
}
bool isprime[1000000 + 5];
void init_prime() {
fill(isprime, isprime + 1000000 + 5, t... |
p00926 Shopping | Example
Input
10 3
3 7
8 9
2 5
Output
23 | {
"input": [
"10 3\n3 7\n8 9\n2 5"
],
"output": [
"23"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, d, flg[1002] = {};
cin >> n >> d;
for (int i = 0; i < d; i++) {
int a, b;
cin >> a >> b;
flg[a] = max(flg[a], b);
}
int sta = 0, sum = 0, L, R;
for (int i = 0; i <= n; i++)
if (flg[i] != 0 && sta == 1)
R = max(R, flg[i])... |
p00926 Shopping | Example
Input
10 3
3 7
8 9
2 5
Output
23 | {
"input": [
"10 3\n3 7\n8 9\n2 5"
],
"output": [
"23"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]){
int n, m;
cin >> n >> m;
int c[m], d[m];
int road[n + 1] = {0};
for (int i = 0; i < m; i++) {
cin >> c[i] >> d[i];
for (int j = c[i]; j < d[i]; j++) {
road[j] = 1;
}
}
int ans = 0;
for (int i = 0; i <= n; i... |
p00926 Shopping | Example
Input
10 3
3 7
8 9
2 5
Output
23 | {
"input": [
"10 3\n3 7\n8 9\n2 5"
],
"output": [
"23"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | public class Main{
public void run(java.io.InputStream in, java.io.PrintStream out){
java.util.Scanner sc = new java.util.Scanner(in);
/*answer*/
int n, m;
int[] c, d;
int i, j, k, tmp, ans;
n = sc.nextInt();
m = sc.nextInt();
c = new int[m];
d = new int[m];
ans = 0;
for(i = ... |
p00926 Shopping | Example
Input
10 3
3 7
8 9
2 5
Output
23 | {
"input": [
"10 3\n3 7\n8 9\n2 5"
],
"output": [
"23"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
const int INF = 1e9;
const double EPS = 1e-8;
const double PI = 3.14159;
int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
using namespace std;
int main() {
int N, m;
cin >> N >> m;
vector<pair<int, int> > list(m), tmp;
for (int i = 0; i < (int)(m); i++) cin >> list[i].second >> list[i]... |
p00926 Shopping | Example
Input
10 3
3 7
8 9
2 5
Output
23 | {
"input": [
"10 3\n3 7\n8 9\n2 5"
],
"output": [
"23"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<ll>;
using VVI = vector<VI>;
using PII = pair<ll, ll>;
const ll LLINF = (1LL << 60);
const ll INF = (1LL << 30);
const ll MOD = 1000000007;
template <typename T>
T &chmin(T &a, const T &b) {
return a = min(a, b);
}
template <typenam... |
p00926 Shopping | Example
Input
10 3
3 7
8 9
2 5
Output
23 | {
"input": [
"10 3\n3 7\n8 9\n2 5"
],
"output": [
"23"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java |
import java.io.*;
import java.util.*;
public class Q3 {
FastScanner in = new FastScanner(System.in);
PrintWriter out = new PrintWriter(System.out);
public void run() {
int n = in.nextInt(), m = in.nextInt();
int[] array = new int[n+1];
for (int i = 0; i < m; i++) {
int c = in.nextInt(), d = in.nextInt... |
p00926 Shopping | Example
Input
10 3
3 7
8 9
2 5
Output
23 | {
"input": [
"10 3\n3 7\n8 9\n2 5"
],
"output": [
"23"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int st[1024];
int main() {
int N, m;
cin >> N >> m;
for (int(i) = (0); ((i)) < ((m)); ++(i)) {
int c, d;
cin >> c >> d;
st[c]++;
st[d]--;
}
for (int(i) = (0); ((i)) < ((N)); ++(i)) st[i + 1] += st[i];
int res = 0;
for (int(i) = (0); ((i)) < ((N... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.be... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | python3 | n, m = map(int, input().split())
a =list(map(int, input().split()))
t = max(a[0] - 1, n - a[-1])
for i in range(1, m):t = max(t, (a[i] - a[i - 1]) // 2)
print(t)
|
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
long long int ans = LLONG_MIN / 6;
long long int now;
cin >> ans;
now = ans;
ans--;
for( size_t i = 1; i < M; i++ ) {
long long int a;
cin >> a;
ans = max( (a - now) / 2, ans );
now = a;
}
ans = max( N - now, ans );
... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
const int INF = 1 << 28;
int N, M, B[100000];
int dp[100000][4];
int rec(int idx, int dir)
{
if(idx < 0 || idx >= N) return(INF);
if(~dp[idx][dir + 1]) return(dp[idx][dir + 1]);
if(B[idx]) return(0);
return(dp[idx][dir + 1] = rec(idx + dir, dir) + 1);
}
int main... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
#define _MACRO(_1, _2, _3, NAME, ...) NAME
#define _repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define _rep(i,n) _repl(i,0,n)
#define rep(...) _MACRO(__VA_ARGS__, _repl, _rep)(__VA_ARGS__)
#define mp make_pair
#define pb push_back
#define all(x) begin(x),end(x)
#define ... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <iostream>
using namespace std;
int main()
{
int n, m;
int a, last_a;
int max_diff = 0;
int diff;
cin >> n >> m;
cin >> a;
last_a = a;
max_diff = a -1;
for (int i = 1; i < m; i++) {
cin >> a;
diff = a - last_a - 1;
!(diff % 2) ? diff /= 2 : diff = diff / 2 + 1;
if (diff >... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl
using namespace std;
typedef long lon... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <iostream>
#include <vector>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
if(m == 1){
int a;
cin >> a;
cout << max(a-1,n-a) << endl;
return 0;
}
vector<int> a(m);
for(int i = 0; i < m; i++){
cin >> a[i];
}
int ans = 0;
for... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | python3 | n, m = map(int, input().split())
li = list(map(int, input().split()))
print(max(li[0]-1, n-li[-1], *[(li[i]-li[i-1])//2 for i in range(1,m)]))
|
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
int n, m, a[100000], ans=0;
cin>>n>>m;
for(int i=0;i<m;i++) cin>>a[i];
for(int i=1;i<m;i++) ans=max(ans, (a[i]-a[i-1])/2);
ans=max(ans, a[0]-1);
ans=max(ans, n-a[m-1]);
cout<<ans<<endl;
return 0;
} |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include<vector>
#include<algorithm>
using namespace std;
struct init{
init(){
cin.tie(0); ios::sync_with_stdio(false);
}
}________init;
int main() {
#ifdef INPUT_FROM_FILE
ifstream cin("sample.in");
ofstream cout("sample.out");
#endif
int n, m;
... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | java | import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;
public class Main{
int N,M;
int[] a;
public void solve() {
N = nextInt();
M = nextInt();
a = new int[M];
for(int i = 0;i < M;i++)a[i] = nextInt();
int ans = 0;
for(int i = 0;i <= ... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int n,m;
cin >> n >> m;
vector<int> a(m);
cin >> a[0];
int ma=0;
for(int i=1;i<m;i++){
cin >> a[i];
int tmp = (a[i]-a[i-1])/2;
ma = max(ma,tmp);
}
//cout << ma << endl;
... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,m;
cin >> n >> m;
int d[n],d2[n],ans=0;
fill(d,d+n,1<<29);
fill(d2,d2+n,1<<29);
for(int i=0,x; i<m; i++) {
cin >> x;
d[x-1]=d2[x-1]=0;
}
for(int i=1; i<n; i++) d[i]=min(d[i],d[i-1]+1);
for(int i=n-2; i>=0; i--) d2[i]=min(d2[i],d... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | /*
* a.cc:
*/
#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>
#include<utility>
#include<complex>
#include<functi... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int t[100000];
int main(){
int n,m; cin>>n>>m;
vector<int> a(m);
for(int i=0;i<n;i++) t[i]=1e9;
queue<int> q;
for(int i=0;i<m;i++){
cin>>a[i]; a[i]--;
t[a[i]]=0;
q.push(a[i]);
}
while(!q.empty()){
int cur=q.front(); q.pop();
if(cur+1<n){
if(t[cur+1]>t[cu... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <stack>
#include <queue>
#include <utility>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#def... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #define _USE_MATH_DEFINES
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<iostream>
#include<fstream>
#include<iomanip>
using namespace std;
int n, m;
int data[100000];
int main(){
scanf("%d%d", &n, &m);
for (int i = 0; i < m; ++i){
scanf("%d",... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define Rep(i, n) for( int i = 0; i < (n); i++ )
#define Rrep(i, a, n) for( int i = (a); i < (n); i++ )
#define All(v) v.begin(), v.end()
typedef pair<int, int> Pii;
typedef... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <iostream>
#include <queue>
#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
using namespace std;
int main() {
int n; cin >> n;
int m; cin >> m;
vector<int> a;
rep(i, m) {
int x; cin >> x; x--;
a.push_back(x);
}
int ans = 0;
REP(i, 0, (int)a.size()-1) {
... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define LL long long
#define Fi first
#define Se second
using namespace std;
static const LL INF = 1LL<<61LL;
typedef pair<int,int> PII;
int N,M;
int A[100010];
int temp=1;
int ans;
int main(){
cin>>N>>M;
re... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <iostream>
using namespace std;
int main(){
int n,m,a[100000],r=0;;
cin>>n>>m;
for(int i=0;i<m;i++) cin>>a[i];
r=max(a[0]-1,n-a[m-1]);
for(int i=1;i<m;i++) r=max(r,(a[i]-a[i-1])/2);
cout<<r<<endl;
return 0;
} |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | python3 | n,m = map(int,input().split())
a = list(map(int,input().split()))
c = [a[0]-1, n-a[m-1]]
for i in range(m-1):
c.append((a[i+1]-a[i])//2)
print(max(c))
|
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
#define DEBUG(x) cout<<#x<<": "<<x... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <iostream>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int n,m;
int a[200005];
int b[200005];
int main() {
cin>>n>>m;
rep(i,m) cin>>a[i];
rep(i,m) a[i]--;
rep(i,200005) b[i]=1e8;
rep(i,m) b[a[i]]=0;
rep(i,n) if(i) {
b[i]=min(b[i],b[i-1]+1)... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<iostream>
#include<vector>
#include<cassert>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<tuple>
#include<numeric>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef ll in... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define pb push_back
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = 1; i <= n; ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define mins(x,y) x = min(x,y)
#define maxs(x,y) x = max(x,y)... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | python3 | n, m = map(int, input().split())
lst = [100000 for _ in range(n)]
a_lst = list(map(int, input().split()))
for a in a_lst:
lst[a - 1] = 0
for i in range(n - 1):
lst[i + 1] = min(lst[i] + 1, lst[i + 1])
for i in range(n - 1, 0, -1):
lst[i - 1] = min(lst[i - 1], lst[i] + 1)
print(max(lst))
|
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | python3 | # AOJ 1574: Gossip
# Python3 2018.7.13 bal4u
n, m = map(int, input().split())
a = list(map(int, input().split()))
pre = a[0]; d = 0
for x in a[1:]:
d = max(d, x-pre)
pre = x
print(max(n-pre, max(d>>1, a[0]-1)))
|
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,m;cin>>n>>m;
int ans=0;
int b;
for(int i=0;i<m;i++){
int a;cin>>a;
if(i==0)ans=max(ans,a-1);
else ans=max(ans,(a-b)/2);
b=a;
}
ans=max(ans,n-b);
cout<<ans<<endl;
return 0;
}
|
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | python3 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
def solve(n, received):
not_relayed = received.copy()
for t in range(n + 1):
if len(received) >= n:
return t
new_not_relayed = set()
for person in not_relayed:
if person >= 1:
if (person - 1) not in ... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | java | import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
PrintWriter pw=new PrintWriter(System.out);
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int m=sc.nextInt();
int[] L=new int[m];
for(int i=0;i<m;i++){
... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <iostream>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
int n, m;
int a[100000];
int main(){
cin >> n >> m;
rep(i, m){
cin >> a[i];
}
int ans = max(a[0] - 1, n - a[m - 1]);
rep(i, m - 1){
ans = max((a[i + 1] - a[i]) / 2, ans);
}
cout << ans ... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <cstdio>
#include <algorithm>
using namespace std;
int main() {
int n, m, t, prev = 1, curr, ans = 0;
scanf("%d %d", &n, &m);
scanf("%d", &curr);
if (curr > 1) {
ans = curr - 1;
prev = curr;
}
for (int i = 1; i < m; i++) {
scanf("%d", &curr);
t = (curr... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | /* _/ _/ _/_/_/ _/
_/_/_/_/ _/_/ _/_/_/_/ _/_/ _/ _/_/
_/ _/ _/ _/ _/ _/ _/_/_/ _/
_/ _/ _/ _/ _/ _/ _/ _/ _/
_/_/ _/_/ _/_/ _/_/ _/_/ _/ */
#include<iostream>
#include<algorithm>
#include<cmath>
#i... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | java | import java.util.*;
public class Main {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
int max = 0;
int prev = 0;
for (int i = 0; i < m; i++) {
int x = sc.nextInt();
max = Math.max((x - prev) / 2, max);
p... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <iostream>
using namespace std;
int N,M;
const int MAX_N = 100010;
const int INF = 1 << 20;
int A[MAX_N];
int Left[MAX_N];
int Right[MAX_N];
int main(){
cin >> N >> M;
int result = 0;
for (int i = 0; i < M; i++){
int x;
cin >> x;
x--;
A[x]++;
}
int tmp = INF;
for (int i = 0; i < ... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main() {
int n, m, i, in, def = 0, ans = 0, before = 0;
cin >> n >> m;
for(i = 0; i < m; i++) {
cin >> in;
if(i == 0 && in != 1) {
def = in - 1;
}
else def = (in-before)/2 +0.5;
ans = max(ans, def);
before... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<iostream>
using namespace std;
int main()
{
int n, m, d;
cin >> n >> m;
bool a[n+2];
for( int i = 0; i < n + 2; i++ )
a[i] = 0;
a[0] = a[n+1] = 1;
int ma = 0;
for( int i = 0; i < m; i++ )
{
cin >> d;
if( i == 0 )
ma = d - 1;
if( i ... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <b... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include "bits/stdc++.h"
using namespace std;
int main() {
int N, M; cin >> N >> M;
vector<int>v;
for (int i = 0; i < M; ++i) {
int a; cin >> a;
v.emplace_back(a);
}
int ans = 0;
ans = max(ans, v[0] - 1);
ans = max(ans, N - v.back());
for (int i = 0; i < M-1; ++i) {
ans = max(ans, (v[i + 1] - v[i]) / 2);... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | java | import java.util.BitSet;
import java.util.Scanner;
public class Main {
public static void main(String[] args){
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
// int[] a = new int[n];
BitSet bs = new BitSet(n);
for(int i=0; i<m; i++){
// a[in.nextInt()] = 1;
bs.set(in.... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <fstream>
#include <iostream>
#include <vector>
#include <iomanip>
#include <algorithm>
using namespace std;
#define ALL(c) (c).begin(), (c).end()
#define REP(i,n) for(ll i=0; i < (n); ++i)
using ll = long long;
using vl = vector<ll>;
int main(){
#ifdef _WIN32
ifstream cin("sample.in");
ofstream cout("sampl... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | python3 | # -*- coding: utf-8 -*-
n, m = map(int, input().split())
a = list(map(int, input().split()))
ma = a[0] - 1
for i in range(m-1):
ma = max(ma, (a[i + 1] - a[i]) // 2)
ma = max(ma, n - a[-1])
print(ma) |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,m;
int a[100001];
int main(void){
scanf("%d%d",&n,&m);
for(int i=0;i<m;i++){
scanf("%d",&a[i]);
}
int ans=max(a[0]-1,n-a[m-1]);
for(int i=0;i<m-1;i++){
ans=max(ans,(a[i+1]-a[i])/2);
}
printf("%d\n",ans);
ret... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | python3 | n,m=map(int,input().split(" "))
a=list(map(int,input().split(" ")))
print(max(a[0]-1,n-a[-1],*[(a[i+1]-a[i])//2 for i in range(m-1)]))
|
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <stdio.h>
int main(void) {
int m, n, i, j, be = 1, ans = 0, t;
scanf("%d%d", &n, &m);
for(i = 0; i < m; ++i) {
scanf("%d", &t);
if(!i) ans = t - 1;
else if((t - be) / 2 > ans) ans = (t - be) / 2;
be = t;
}
if(n - be > ans) ans = n - be;
printf("%d\n", ans);
return 0;
}
|
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pa... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<iostream>
using namespace std;
int main(){
int sum;
while(cin >> sum){
int number, info[100005], ans;
cin >> number;
for(int i = 0; i < number; i++){
cin >> info[i];
}
for(int i = 0; i < number + 1; i++){
if(!i){
ans = info[i] - 1;
}else if(i == number){
ans = max(ans, sum ... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | /*
_ooOoo_
o8888888o
88" . "88
(| -_- |)
O\ = /O
____/`---'\____
.' \\| |// `.
/ \\||| : |||// \
/ _||||| -:- |||||- \
| | \\\ - /// | |
... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>
using namespace std;
#define ll long long
#d... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <iostream>
#include <vector>
int main()
{
int n, m;
std::cin >> n >> m;
std::vector<int> min_t(n, (1 << 29));
for (int i = 0; i < m; i++) {
int a;
std::cin >> a;
min_t[a - 1] = 0;
}
for (int i = 1; i < n; i++) {
min_t[i] = std::min(min_t[i], min_t[... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#define rep(i,a,b) for(int (i)=(a);i<(b);i++)
#define INF 100000000
#define MAX_N 1000000
using namespace std;
int main(){
int n,m,a=0,b=0;
cin>>n>>m;
... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"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>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include<iostream>
#include<iomanip>
#include<string>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<iomanip>
using namespace std;
int main() {
int n,m;
cin >> n >> m;
int count = 0;
int input;
int ex;
for(int i=0; i<m; i++) {
cin >> input;
if(i == 0 && input-1 > count) c... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n ;
int m;
int a[100000];
int b;
int ans = 0;
cin >> n >> m;
for (int i = 0; i < m; i++){
cin >> a[i];
}
for (int i = 0; i < m + 1; i++){
if (i == 0){
b = a[i] - 1;
} else if (i == m){
b = n - a[i - 1];
}
else{
... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
using namespace std;
int main(void)
{
int n,m;
cin >> n >> m;
vector<int> se;
se.resize(m);
REP(i,m) cin >> se[i];
int answer=0;
answer=max(... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#define re... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
using nam... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
set<int> ok;
for(int i = 0; i < m; ++i) {
int a;
cin >> a;
ok.emplace(a);
}
int ans = 0;
for(int i = 1; i <= n; ++i) {
auto it = ok.lower_bound(i);
int mn = INT_MAX;
if(it != ok.end()) {
mn = min(mn, *it - i);
... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
vector<int> A;
A.push_back(1);
int a;
for(int i = 1; i <= m; i++)
{
cin >> a;
A.push_back(a);
}
A.push_back(n);
int ans = 0;
for(int i = 1; i < A.size(); i++)
{
int tmp;
if(i == 1 || i == A.size() - 1)
tmp = A[i] ... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct init {
init() {
cin.tie(0);
ios::sync_with_stdio(false);
}
} ________init;
int main() {
int n, m;
cin >> n >> m;
vector<int> a(m);
for (auto& it : a) {
cin >> it;
}
int res = 0;
res = max(res, n - a[m - 1]);
res = max(res, a[0] - 1);
... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
static const long long INF = 1LL << 61LL;
int N, M;
int A[100010];
int temp = 1;
int ans;
int main() {
cin >> N >> M;
for (int i = 0; i < M; ++i) {
int a;
cin >> a;
A[a] = 1;
}
for (int i = 1; i <= N; ++i) {
if (A[i] == 1) {
int t = (i - temp -... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int sum;
while (cin >> sum) {
int number, info[100005], ans;
cin >> number;
for (int i = 0; i < number; i++) {
cin >> info[i];
}
if (sum == number) {
cout << '0' << endl;
} else {
for (int i = 0; i < number + 1; i++... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
long long esp_org, esp_new;
int deg[100010];
vector<int> g[100010];
set<int> A, B;
int N;
void rekkyo(int x, int p) {
A.erase(x);
B.insert(x);
for (auto e : g[x]) {
if (e != p) {
rekkyo(e, x);
}
}
}
int subtree(int x, int p) {
int ans = 0;
for (aut... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | /*
N???2??????
t???+-2pi/n
a????????§in space???FFT?????????
*/
typedef double D;
typedef complex<D> P;
D pi=acos(-1);
void FFT(vector<P>& a,int N,double t){
for(int m=N;m>=2;m/=2){
int mh=m/2;
rep(i,mh){
P w=polar(1.0,t*i);
for(int j=i;j<N;j+=m){
int k=j+mh;
P x=a[j]-a[k];
a[j]+=a[k];
a[k]=w... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | /*
suffix array
sa[i]= i??????????°???????suffix???????????????index (sa[0]=N)
_k,_N?????°????????????????????£?????????(compare???2?????°???????????????)
RMQ??¨????????° s?????§????????????t?????????????????´??? ???????????????????????????(jag2014summerday4F)
lcp[i]= len of common prefix of s[sa[i]..],s[sa[i+1]... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int m;
int a[100000];
int b;
int ans = 0;
int main() {
cin >> n >> m;
for (int i = 0; i < m; i++) {
cin >> a[i];
}
for (int i = 0; i < m + 1; i++) {
if (i == 0) {
b = a[i] - 1;
} else if (i == m) {
b = n - a[i];
} else {
b = ... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
static const long long INF = 1LL << 61LL;
int N, M;
int A[100010];
int temp = 1;
int ans;
int main() {
cin >> N >> M;
for (int i = 0; i < M; ++i) {
int a;
cin >> a;
A[a] = 1;
}
for (int i = 1; i <= N; ++i) {
if (A[i] == 1) {
if (temp == 1 && A[... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, a = 0, b = 0;
cin >> n >> m;
int ans = 0;
for (int(i) = (0); i < (m); i++) {
cin >> a;
ans = max(a - b, ans);
b = a;
}
if (ans / 2 < n - a)
cout << n - a << endl;
else
cout << ans / 2 << endl;
return 0;
}
|
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main(void) {
long long n, m, a[100000], x[100000];
cin >> n >> m;
for (int i = 0; i < m; i++) {
cin >> a[i];
}
for (int j = 0; j < n; j++) {
x[j] = 0;
for (int i = 0; i < m; i++) {
if (j == a[i] - 1) {
x[j] = 1;
}
}
}
in... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | n, m = map(int, input().split())
a =[0] + list(map(int, input().split())) + [n]
t = max(a[0] - 1, n - a[-1])
for i in range(1, m):t = max(t, -((a[i - 1] - a[i]) // 2))
print(t)
|
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m, A[100000], ans;
int i;
cin >> n >> m;
for (i = 0; i < m; i++) {
cin >> A[i];
if (m == 1) {
cout << max(n - A[0], A[0] - 1) << endl;
return -1;
} else if (m == 2 && i == 1) {
ans = max(A[0] - 1, n - A[1]);
an... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <class X>
void print(X Target) {
cout << Target << '\n';
}
bool check[100001];
bool tmp[100001];
signed main() {
ios::sync_with_stdio(false);
int n, m;
cin >> n >> m;
for (int i = 0; i < m; i++) {
int a;
cin >> a;
check[a] = true;
}
if (m ... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
static const long long INF = 1LL << 61LL;
int N, M;
int A[100010];
int temp = 1;
int ans;
int main() {
cin >> N >> M;
for (int i = 0; i < M; ++i) {
int a;
cin >> a;
A[a] = 1;
}
for (int i = 1; i <= N; ++i) {
if (A[i] == 1) {
if (temp == 1 && A[... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
bool ok(long long t, long long n, long long m, vector<long long> x) {
long long p = 0;
for (int i = 0; i < m; i++) {
if (p < x[i]) {
if (x[i] - p > t) {
return false;
}
p = max(x[i] + (t - 2 * (x[i] - p)) + 1, x[i] + (t - (x[i] - p)) / 2 + ... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | n,m,*a=$<.read.split.map &:to_i;p [a[1]-1,*a.each_cons(2).map{|x,y|(y-x)/2},n-a[-1]].max |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
using namespace std;
int main(void)
{
int n,m;
cin >> n >> m;
vector<int> se;
se.resize(m);
REP(i,m) cin >> se[i];
int answer=0;
answer=max(... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int sum;
while (cin >> sum) {
int number, info[10005], ans;
cin >> number;
for (int i = 0; i < number; i++) {
cin >> info[i];
}
for (int i = 0; i < number + 1; i++) {
if (!i) {
ans = info[i] - 1;
} else if (i ==... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <class X>
void print(X Target) {
cout << Target << '\n';
}
bool check[100001];
bool tmp[100001];
signed main() {
ios::sync_with_stdio(false);
int n, m;
cin >> n >> m;
int a;
for (int i = 0; i < m; i++) {
cin >> a;
}
if (m == 1) {
print(n - a... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | n, m = map(int, input().split())
a =list(map(int, input().split()))
t = max(a[0] - 1, n - a[-1])
for i in range(1, m):t = max(t, -((a[i - 1] - a[i]) // 2))
print(t)
|
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
for (long long i = 0; i < (long long)(v.size()); i++)
os << v[i] << (i != v.size() - 1 ? " " : "\n");
return os;
}
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
f... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | n,m,*a=$<.read.split.map &:to_i;p [a[1]-1]+a.each_cons(2).map{|x,y|(y-x+1)/2}+[n-a[-1]] |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
const double PI = acos(-1);
const double EPS = 1e-10;
const int inf = 1e8;
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<int> in(m);
for (int i = 0; i < m; i++) cin >> in[i];
int ma = in[0] - 1;
for (int i = 0; i < m; i++) {
int q = in[i + 1] - in[i];
q /... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | https://www.slideshare.net/cocoa_chan/rupc2016-day2-d?qid=1931cae0-cc15-435b-ba12-0e9bc5aeb296&v=&b=&from_search=1 |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
static const long long INF = 1LL << 61LL;
int N, M;
int A[100010];
int temp = 1;
int ans;
int main() {
cin >> N >> M;
for (int i = 0; i < M; ++i) {
int a;
cin >> a;
A[a] = 1;
}
for (int i = 1; i <= N; ++i) {
if (A[i] == 1) {
int t = (i - temp -... |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | n,m,*a=$<.read.split.map &:to_i;p [a[1]-1,*a.each_cons(2).map{|x,y|(y-x+1)/2},n-a[-1]].max |
p01059 Gossip | Problem
N idols, numbered from 1 to n in order, are lined up in a row.
Idle i can transmit information to idle i-1 and idle i + 1 in a unit time. However, idol 1 can transmit information only to idol 2, and idol n can transmit information only to idol n-1.
At time 0, m idols with numbers a1, a2, ..., am have secret i... | {
"input": [
"10 3\n2 5 7",
"100000 1\n1",
"10 5\n2 5 6 8 10",
"3 2\n1 3"
],
"output": [
"3",
"99999",
"1",
"1"
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl
using namespace std;
typedef long lon... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.