submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s646208730 | p03866 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define all(v) (v).begin(),(v).end()
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define pb push_back
#define fi first
#define se second
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
#define D double
typedef pair<D,int>T;
int N;
int X[1111],Y[1111],R[1111];
D dist[1111];
D INF=1e10;
D EPS=1e-9;
int table2[1111][1111];
D table[1111][1111];
signed main(){
cin>>X[0]>>Y[0]>>X[1]>>Y[1];
cin>>N;
rep(i,N)cin>>X[i+2]>>Y[i+2]>>R[i+2];
N+=2;
rep(i,N)rep(j,N){
table2[i][j]=(X[i]-X[j])*(X[i]-X[j])+(Y[i]-Y[j])*(Y[i]-Y[j]);
table[i][j]=sqrt(1.0*table2[i][j]);
}
fill_n(dist,1111,INF);
dist[0]=0;
priority_queue<T,vector<T>,greater<T>>que;
que.push(make_pair(0,0));
while(que.size()){
D d;
int idx;
tie(d,idx)=que.top();
que.pop();
if(dist[i]<d) continue;
rep(i,N){
int foo=table2[i][idx];
int bar=R[i]+R[idx];
D cost=d;
if(foo>bar*bar+EPS) cost+=sqrt(1.0*foo)-bar;
if(dist[i]>EPS+cost){
dist[i]=cost;
que.push(T(dist[i],i));
}
}
}
printf("%.20f\n",dist[1]);
return 0;
} | a.cc: In function 'int main()':
a.cc:51:17: error: 'i' was not declared in this scope
51 | if(dist[i]<d) continue;
| ^
|
s412983750 | p03866 | Java | /*
* Code Author: Akshay Miterani
* DA-IICT
*/
import java.io.*;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.text.DecimalFormat;
import java.util.*;
public class MainA {
static double eps=(double)1e-10;
static long mod=(long)1e9+7;
static final long INF = Long.MAX_VALUE / 100;
public static void main(String args[]) throws FileNotFoundException{
InputReader in = new InputReader(System.in);
OutputStream outputStream = System.out;
PrintWriter out = new PrintWriter(outputStream);
//----------------My Code------------------
double xs=in.nextInt();
double ys=in.nextInt();
double xt=in.nextInt();
double yt=in.nextInt();
int n=in.nextInt();
double p[][]=new double[n+2][3];
for(int i=0;i<n;i++){
p[i][0]=in.nextInt();
p[i][1]=in.nextInt();
p[i][2]=in.nextInt();
}
p[n][0]=xs;
p[n][1]=ys;
p[n][2]=0;
p[n+1][0]=xt;
p[n+1][1]=yt;
p[n+1][2]=0;
List<Edge>[] edges = new List[n+2];
for (int i = 0; i < n+2; i++) {
edges[i] = new ArrayList<>();
}
for(int i=0;i<n+2;i++){
for(int j=0;j<n+2;j++){
edges[i].add(new Edge(j, md(p[i], p[j])));
}
}
double ans[]=new double[n+2];
shortestPaths(edges, n, ans);
out.printf("%.10f\n",ans[n+1]);
out.close();
//----------------The End------------------
}
static double md(double p1[], double p2[]){
return Math.max(0, dist(p1[0], p1[1], p2[0], p2[1])-p1[2]-p2[2]);
}
static double dist(double x1,double y1,double x2,double y2){
return Math.sqrt(Math.pow(x1-x2,2)+Math.pow(y1-y2, 2));
}
public static void shortestPaths(List<Edge>[] edges, int s, double[] prio) {
Arrays.fill(prio, INF);
prio[s] = 0;
PriorityQueue<Pair> q = new PriorityQueue<>(100, new cmp());
q.add(new Pair(0, s));
while (!q.isEmpty()) {
Pair cur = q.remove();
int curu = cur.p;
if (Math.abs(cur.x-prio[curu])>eps)
continue;
for (Edge e : edges[curu]) {
int v = e.t;
double nprio = prio[curu] + e.cost;
if (prio[v] > nprio) {
prio[v] = nprio;
q.add(new Pair(nprio, v));
}
}
}
}
static class cmp implements Comparator<Pair>{
@Override
public int compare(Pair o1, Pair o2) {
return Double.compare(o1.x, o2.x);
}
}
static class Edge {
int t;
double cost;
public Edge(int t, double cost) {
this.t = t;
this.cost = cost;
}
}
static long modulo(long a,long b,long c) {
long x=1;
long y=a;
while(b > 0){
if(b%2 == 1){
x=(x*y)%c;
}
y = (y*y)%c; // squaring the base
b /= 2;
}
return x%c;
}
static long gcd(long x, long y)
{
if(x==0)
return y;
if(y==0)
return x;
long r=0, a, b;
a = (x > y) ? x : y; // a is greater number
b = (x < y) ? x : y; // b is smaller number
r = b;
while(a % b != 0)
{
r = a % b;
a = b;
b = r;
}
return r;
}
static class Pair implements Comparable<Pair>{
double x;
int p;
Pair(double xx,int pp){
x=xx;
p=pp;
}
@Override
public int compareTo(Pair o) {
return Double.compare(this.x, o.x);
}
}
public static void debug(Object... o) {
System.out.println(Arrays.deepToString(o));
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream inputstream) {
reader = new BufferedReader(new InputStreamReader(inputstream));
tokenizer = null;
}
public String nextLine(){
String fullLine=null;
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
fullLine=reader.readLine();
} catch (IOException e) {
throw new RuntimeException(e);
}
return fullLine;
}
return fullLine;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public long nextLong() {
return Long.parseLong(next());
}
public int nextInt() {
return Integer.parseInt(next());
}
}
} | Main.java:11: error: class MainA is public, should be declared in a file named MainA.java
public class MainA {
^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
|
s928147910 | p03866 | C++ | #include<cstdio>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<cmath>
#include<queue>
using namespace std;
int main(void){
long double a[1002][1002];
int n;
int x[1002];
int y[1002];
int r[1002];
long double d[1002];
int e[1002];
priority_queue<pair<double, int>> t;
pair<double, int> pai;
long long z;
long long c;
int p;
int q;
int s;
int k;
int zz;
scanf("%d %d %d %d", &s, &k, &p, &q);
scanf("%d", &n);
x[0] = s;
y[0] = k;
x[n + 1] = p;
y[n + 1] = q;
r[0] = 0;
r[n + 1] = 0;
for (int i = 1; i <= n; i++){
scanf("%d %d %d", &x[i], &y[i], &r[i]);
}
for (int i = 0; i < n + 2; i++){
for (int j = i + 1; j < n + 2; j++){
z = (y[j] - y[i])*(y[j] - y[i]);
z = (x[j] - x[i])*(x[j] - x[i]) + z;
a[i][j] = sqrt(z) - r[i] - r[j];
a[j][i] = sqrt(z) - r[i] - r[j];
if(a[i][j]<0){
a[i][j]=0;
a[j][i]=0;
}
}
a[i][i] = 1;
d[i] = 200000000;
e[i] = 0;
}
d[0] = 0;
t.push(make_pair(d[0], 0));
for (int i = 0; t.empty() == 0 && e[n + 1] == 0; i++){
zz = 0;
for (int j = 0; t.empty() == 0 && zz == 0; j++){
pai = t.top();
z = pai.second;
if (e[z] == 0)zz++;
else t.pop();
}
if (zz == 0)break;
e[z] = 1;
for (int j = 0; j < n + 2; j++){
if (d[z] + a[z][j] < d[j])
{
d[j] = d[z] + a[z][j];
t.push(make_pair(-d[j], j));
}
}
t.pop();
}
double m;
int dd[20];
m = d[n + 1];
printf(" %llf\n",d[n+1]);
return 0;
} | a.cc:62:1: error: extended character is not valid in an identifier
62 |
| ^
a.cc:68:1: error: extended character is not valid in an identifier
68 |
| ^
a.cc:74:1: error: extended character is not valid in an identifier
74 |
| ^
a.cc: In function 'int main()':
a.cc:62:1: error: '\U000000a0' was not declared in this scope
62 |
| ^
a.cc:68:2: error: expected ';' before 't'
68 |
| ^
| ;
69 | t.push(make_pair(-d[j], j));
| ~
a.cc:74:1: error: '\U000000a0' was not declared in this scope
74 |
| ^
a.cc:77:9: error: 'm' was not declared in this scope
77 | m = d[n + 1];
| ^
|
s432524166 | p03866 | C++ | #include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <set>
#include <algorithm>
#include <queue>
#include <math.h>
#include <iomanip>
using namespace std;
double max(double a, double b)
{
if(a<=b)
return b;
else
return a;
}
double dist(pair <int, int> c1, pair <int, int> c2, int r1, int r2)
{
return max(0, pow(((c1.first-c2.first)*(c1.first-c2.first)+(c1.second-c2.second)*(c1.second-c2.second)),0.5) - r1 - r2);
}
double min(double a, double b)
{
if(a<=b)
return a;
else
return b;
}
int main()
{
pair <int, int> s;
pair <int, int> e;
cin>>s.first>>s.second;
cin>>e.first>>e.second;
int n;
cin>>n;
pair < pair<int, int>, int> list[1005];
for(int i=1;i<=n;i++)
cin>>list[i].first.first>>list[i].first.second>>list[i].second;
list[0].first.first=s.first;
list[0].first.second=s.second;
list[0].second=0;
list[n+1].first.first=e.first;
list[n+1].first.second=e.second;
list[n+1].second=0;
vector <pair <int, double> > adj[1005];
for(int i=0;i<=n+1;i++)
{
for(int j=i+1;j<=n+1;j++)
{
adj[i].push_back(make_pair(j,dist(list[i].first,list[j].first,list[i].second,list[j].second)));
adj[j].push_back(make_pair(i,dist(list[i].first,list[j].first,list[i].second,list[j].second)));
}
}
priority_queue <pair <double, int>, vector <pair <double, int> >, greater <pair <double, int> > > q;
int start=0;
bool check[5000]={false};
double distance[1005];
for(int i=0;i<1005;i++)
distance[i]=1e17;
distance[start]=0;
q.push(make_pair(0,start));
while(!q.empty())
{
vector < pair<int, double> > ::iterator it;
int flag=0;
double temp;
while(flag==0 and !q.empty())
{
temp=q.top().second;
if(fabs(q.top().first-distance[temp])<=1e-9)
flag=1;
else
q.pop();
}
if(q.empty())
break;
for(it=adj[temp].begin();it!=adj[temp].end();it++)
{
if(check[(*it).first]==false)
{
if(distance[(*it).first]>q.top().first+(*it).second)
{
distance[(*it).first]=min(distance[(*it).first], q.top().first+(*it).second);
q.push(make_pair(distance[(*it).first], (*it).first));
}
}
}
q.pop();
check[temp]=true;
}
cout<< fixed << setprecision(15)<<distance[n+1];
return 0;
}
| a.cc: In function 'int main()':
a.cc:78:47: error: invalid types 'double [1005][double]' for array subscript
78 | if(fabs(q.top().first-distance[temp])<=1e-9)
| ^
a.cc:85:23: error: invalid types 'std::vector<std::pair<int, double> > [1005][double]' for array subscript
85 | for(it=adj[temp].begin();it!=adj[temp].end();it++)
| ^
a.cc:85:45: error: invalid types 'std::vector<std::pair<int, double> > [1005][double]' for array subscript
85 | for(it=adj[temp].begin();it!=adj[temp].end();it++)
| ^
a.cc:97:18: error: invalid types 'bool [5000][double]' for array subscript
97 | check[temp]=true;
| ^
|
s404385439 | p03866 | C++ | #include<cstdio>
#include<cstring>
#include<cstdlib>
#include<vector>
#include<cmath>
#include<queue>
using namespace std;
int main(void){
long double a[1002][1002];
int n;
int x[1002];
int y[1002];
int r[1002];
long double d[1002];
int e[1002];
priority_queue<pair<double, int>> t;
pair<double, int> pai;
long long z;
long long c;
int p;
int q;
int s;
int k;
int zz;
scanf("%d %d %d %d",&s, &k, &p, &q);
scanf("%d", &n);
x[0] = s;
y[0] = k;
x[n + 1] = p;
y[n + 1] = q;
r[0] = 0;
r[n + 1] = 0;
for (int i = 1; i <= n; i++){
scanf("%d %d %d", &x[i], &y[i], &r[i]);
}
for (int i = 0; i < n + 2; i++){
for (int j = i+1; j < n + 2; j++){
z = (y[j] - y[i])*(y[j] - y[i]);
z = (x[j] - x[i])*(x[j] - x[i]) + z;
a[i][j] = sqrt(z)-r[i]-r[j];
a[j][i] = sqrt(z)-r[i]-r[j];
}
a[i][i] = 1;
d[i] = 200000000000;
e[i] = 0;
}
d[0] = 0;
t.push(make_pair(d[0], 0));
for (int i = 0; t.empty() == 0&&e[n+1]==0; i++){
zz = 0;
for (int j = 0; t.empty() == 0 && zz == 0; j++){
pai = t.top();
z = pai.second;
if (e[z] == 0)zz++;
else t.pop();
}
if (zz == 0)break;
e[z] = 1;
for (int j = 0; j < n+2; j++){
if (d[z] + a[z][j] < d[j])
{
d[j] = d[z] + a[z][j];
t.push(make_pair(-d[j],j));
}
}
t.pop();
}
double m;
int dd[20];
m = d[n + 1];
for (int i = 0; i < 15; i++){
if (i<10)dd[i] = round(m - 0.4999999999999);
else dd[i] = round(m);
m = m - dd[i];
m = m * 10;
printf("%d", dd[i]);
if (i == 0)printf(".");
}
printf("\n");
return 0;
} | a.cc:58:1: error: extended character is not valid in an identifier
58 |
| ^
a.cc:81:1: error: extended character is not valid in an identifier
81 |
| ^
a.cc: In function 'int main()':
a.cc:58:1: error: '\U000000a0' was not declared in this scope
58 |
| ^
a.cc:81:1: error: '\U000000a0' was not declared in this scope
81 |
| ^
|
s954396902 | p03866 | C++ | #include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define PrintLn(X) cout << X << endl
#define Rep(i, n) for(int i = 0; i < (int)(n); ++i)
double d[1002][1002];
double x[1002];
double y[1002];
double r[1002];
double cost[1002];
int done[1002] = {0};
int main(void)
{
cin >> x[0] >> y[0];
double xt, yt;
cin >> xt >> yt;
int N;
cin >> N;
x[N + 1] = xt;
y[N + 1] = yt;
Rep(i, N){
cin >> x[i + 1] >> y[i + 1] >> r[i + 1];
}
Rep(a, N + 2){
cost[a] = -1;
Rep(b, N + 2){
double dd = sqrt(pow(x[a] - x[b], 2) + pow(y[a] - y[b], 2)) - r[a] - r[b];
if(dd < 0) dd = 0;
d[a][b] = d[b][a] = dd;
}
}
cost[0] = 0;
while(1){
int p = -1;
Rep(i, N + 2){
if(done[i] || cost[i] < 0){
continue;
}
if(p == -1){
p = i;
}else if(cost[i] < cost[p]){
p = i;
}
}
if(p == -1){
break;
}
done[p] = 1;
Rep(i, N + 2){
if(i == p) continue;
double cost_ = cost[p] + d[p][i];
if(cost[i] < 0 || cost[i] > cost_){
cost[i] = cost_;
}
}
}
printf("%.10f\n", cost[N + 1]);
return 0;
}
| a.cc: In function 'int main()':
a.cc:34:42: error: 'pow' was not declared in this scope
34 | double dd = sqrt(pow(x[a] - x[b], 2) + pow(y[a] - y[b], 2)) - r[a] - r[b];
| ^~~
a.cc:34:37: error: 'sqrt' was not declared in this scope
34 | double dd = sqrt(pow(x[a] - x[b], 2) + pow(y[a] - y[b], 2)) - r[a] - r[b];
| ^~~~
|
s451151207 | p03866 | C | #include <stdio.h>
#include <math.h>
#define INF 1000000000
typedef struct {
int x;
int y;
int r;
} baria;
double distance (baria a, baria b) {
double result;
result = sqrt(pow((double)a.x - (double)b.x, 2) + pow((double)a.y - (double)b.y, 2));
result -= (a.r + b.r);
if (result < 0) return 0;
return result;
}
int main() {
int i, j;
double kyori;
int N;
int xs, ys, xt, yt;
scanf("%d %d %d %d", &xs, &ys, &xt, &yt);
scanf("%d", &N);
typedef struct {
double dist[N+2];
double cost;
int isUsed;
} daiku;
baria bar[N+2];
bar[0].x = xs;
bar[0].y = ys;
bar[0].r = 0;
bar[N+1].x = xt;
bar[N+1].y = yt;
bar[N+1].r = 0;
for (i = 1; i < N+2; i++) {
scanf("%d %d %d", &bar[i].x, &bar[i].y, &bar[i].r);
}
daiku dai[N+2];
for (i = 0; i < N+2; i++) {
for (j = 0; j < N+2; j++) {
dai[i].dist[j] = distance(bar[i], bar[j]);
}
dai[i].cost = INF;
dai[j].isUsed = 0;
}
dai[0].cost = 0;
dai[0].isUsed = 1;
while(1){
double min = INF;
for(i = 0; i < N+2; i++){
if(!dai[i].isUsed && min > dai[i].cost) min = dai[i].cost;
}
if(min == INF)
break;
for(i = 0; i < N+2; i++){
if(dai[i].cost == min){
for(j = 0; j < N+2; j++){
if(dai[j].cost > dai[i].dist[j] + dai[i].cost) {
dai[j].cost = dai[i].dist[j] + dai[i].cost
}
}
}
}
}
printf("%lf\n", dai[N+1].cost);
return 0;
} | main.c: In function 'main':
main.c:68:67: error: expected ';' before '}' token
68 | dai[j].cost = dai[i].dist[j] + dai[i].cost
| ^
| ;
69 | }
| ~
|
s918832742 | p03866 | C++ | #include <cstdio>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <vector>
#include <queue>
using namespace std;
#define INF 1e12
#define maxn 1005
int x[maxn];
int y[maxn];
int r[maxn];
int vis[maxn];
double dis[maxn];
vector<pair<int, double>>G[maxn];
struct point{
int id;
double dis;
point(int id, double dis) : id(id),dis(dis){}
bool operator <(const point &x)const{
return x.dis < dis;
}
};
int main()
{
int xs, ys, xt, yt;
cin >> xs >> ys >> xt >> yt;
int n;
cin >> n;
for (int i = 1; i <= n; i++){
scanf("%d%d%d", &x[i], &y[i], &r[i]);
}
x[0] = xs; y[0] = ys; x[n + 1] = xt; y[n + 1] = yt; r[0] = 0; r[n + 1] = 0;
for (int i = 0; i <= n + 1; i++){
for (int j = 0; j <= n + 1; j++){
double dis = sqrt((x[i] - x[j])*(x[i] - x[j]) + (y[i] - y[j])*(y[i] - y[j]));
if (r[i] + r[j] >= dis)
dis = 0;
else
dis = dis - r[i] - r[j];
G[i].push_back(make_pair(j, dis));
G[j].push_back(make_pair(i, dis));
}
}
memset(vis, 0, sizeof(vis));
for (int i = 0; i <= n + 1; i++)
dis[i] = INF;
vis[0] = 1;
dis[0] = 0.0;
priority_queue<point>q;
q.push(point(0, 0.0));
while (!q.empty()){
int cur = q.top().id;
q.pop();
vis[cur] = 1;
for (int i = 0; i < G[cur].size(); i++){
int np = G[cur][i].first;
if (vis[np] != 1 && dis[np] > dis[cur] + G[cur][i].second){
dis[np] = dis[cur] + G[cur][i].second;
q.push(point(np, dis[np]));
}
}
}
printf("%0.10lf\n", dis[n + 1]);
return 0;
}
| a.cc: In function 'int main()':
a.cc:45:9: error: 'memset' was not declared in this scope
45 | memset(vis, 0, sizeof(vis));
| ^~~~~~
a.cc:7:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
6 | #include <queue>
+++ |+#include <cstring>
7 | using namespace std;
|
s837190218 | p03866 | C++ | #include <iostream>
#include <cmath>
#include <queue>
#include <iomanip>
using namespace std;
typedef pair<double, int> P;
int xs, ys, xt, yt;
int N;
int x[1000], y[1000], r[1000];
struct edge {int to; double cost;};
vector<edge> G[1002];
double d[1002];
void dijkstra(int s){
priority_queue<P, vector<P>, greater<P>> que;
fill(d, d+N+2, DBL_MAX);
d[s] = 0.0;
que.push(P(0, s));
while(!que.empty()){
P p = que.top(); que.pop();
int v = p.second;
if(d[v] < p.first) continue;
for(int i=0; i<G[v].size(); i++){
edge e = G[v][i];
if(d[e.to] > d[v] + e.cost){
d[e.to] = d[v] + e.cost;
que.push(P(d[e.to], e.to));
}
}
}
}
double getCost(int x1, int y1, int r1, int x2, int y2, int r2){
double temp = sqrt(pow(x1-x2, 2) + pow(y1-y2, 2));
return max(0.0, temp - r1 - r2);
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cin >> xs >> ys >> xt >> yt;
cin >> N;
for(int i=0; i<N; i++){
cin >> x[i] >> y[i] >> r[i];
}
for(int i=0; i<N; i++){
double c = getCost(xs, ys, 0, x[i], y[i], r[i]);
G[0].push_back(edge{i+1, c});
G[i+1].push_back(edge{0, c});
c = getCost(xt, yt, 0, x[i], y[i], r[i]);
G[N+1].push_back(edge{i+1, c});
G[i+1].push_back(edge{N+1, c});
}
for(int i=0; i<N; i++){
for(int j=0; j<N; j++){
double c = getCost(x[i], y[i], r[i], x[j], y[j], r[j]);
G[i+1].push_back(edge{j+1, c});
G[j+1].push_back(edge{i+1, c});
}
}
dijkstra(0);
cout << setprecision(32) << d[N+1] << endl;
return 0;
}
| a.cc: In function 'void dijkstra(int)':
a.cc:17:20: error: 'DBL_MAX' was not declared in this scope
17 | fill(d, d+N+2, DBL_MAX);
| ^~~~~~~
a.cc:5:1: note: 'DBL_MAX' is defined in header '<cfloat>'; this is probably fixable by adding '#include <cfloat>'
4 | #include <iomanip>
+++ |+#include <cfloat>
5 | using namespace std;
|
s097288100 | p03866 | C++ | ・ソ#include <iostream>
#include <sstream>
#include <string>
#include <cmath>
#include <climits>
#include <cstdio>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <functional>
#include <numeric>
#include <iomanip>
using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())
#define pb push_back
#define mp make_pair
#define mt make_tuple
template <typename T>
class Dijkstra {
struct edge { int to; T cost; };
typedef pair<T, int> P; // <譛遏ュ霍晞屬, 鬆らせ逡ェ蜿キ>
public:
T INF;
Dijkstra(int V)
: INF(std::numeric_limits<T>::max())
, m_V(V)
{
m_G.resize(m_V);
}
// a -> b縺ォ迚・婿蜷代・繧ィ繝・ず繧貞シオ繧・
void add_dir_edge(int a, int b, T cost) {
m_G[a].push_back( edge{ b, cost } );
}
// a <-> b縺ォ荳。譁ケ蜷代・繧ィ繝・ず繧貞シオ繧・
void add_undir_edge(int a, int b, T cost) {
add_dir_edge(a, b, cost);
add_dir_edge(b, a, cost);
}
// 鬆らせs縺九i蜷・らせ縺セ縺ァ縺ョ霍晞屬繧定ィ育ョ励@縺ヲ霑斐☆
vector<T> shortest_path(int s) {
vector<T> d(m_V, INF);
priority_queue<P, vector<P>, greater<P> > que;
d[s] = 0;
que.push(P(0, s));
while(!que.empty()) {
P p = que.top();
que.pop();
auto dist = p.first;
auto v = p.second;
if (d[v] < dist) continue;
REP(i, m_G[v].size()) {
edge e = m_G[v][i];
if (d[e.to] > d[v] + e.cost) {
d[e.to] = d[v] + e.cost;
que.push(P(d[e.to], e.to));
}
}
}
return d;
}
private:
int m_V;
vector<vector<edge> > m_G;
};
int main(void)
{
cin.sync_with_stdio(false);
pair<ll,ll> s, e;
cin >> s.first >> s.second >> e.first >> e.second;
int N;
cin >> N;
vector<tuple<ll,ll,ll>> circles;
REP(n,N) {
ll x, y, r;
cin >> x >> y >> r;
circles.pb( mt(x,y,r) );
}
circles.pb( mt(s.first, s.second, 0) );
circles.pb( mt(e.first, e.second, 0) );
// start: N
// end: N+1
int size = SIZE(circles);
Dijkstra<double> dij(size);
REP(i, size-1) {
const auto& c1 = circles[i];
FOR(j, i+1, size) {
const auto& c2 = circles[j];
auto len1 = abs(get<0>(c1) - get<0>(c2));
auto len2 = abs(get<1>(c1) - get<1>(c2));
double dist = hypot(len1, len2);
dist -= get<2>(c1) + get<2>(c2);
dist = max(0.0, dist);
//cout << "dist:" << dist << endl;
dij.add_undir_edge(i, j, dist);
}
}
auto shortests = dij.shortest_path(N);
//for(auto e: shortests) {
// cout << e << ",";
//}
//cout << endl;
printf("%.13lf\n", shortests[N + 1]);
return 0;
}
| a.cc:1:4: error: stray '#' in program
1 | ・ソ#include <iostream>
| ^
a.cc:1:1: error: '\U000030fb\U0000ff7f' does not name a type
1 | ・ソ#include <iostream>
| ^~~
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/istream:40,
from /usr/include/c++/14/sstream:40,
from a.cc:2:
/usr/include/c++/14/bits/postypes.h:68:11: error: 'ptrdiff_t' does not name a type
68 | typedef ptrdiff_t streamsize; // Signed integral type
| ^~~~~~~~~
/usr/include/c++/14/bits/postypes.h:41:1: note: 'ptrdiff_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
40 | #include <cwchar> // For mbstate_t
+++ |+#include <cstddef>
41 |
In file included from /usr/include/c++/14/bits/exception_ptr.h:38,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41:
/usr/include/c++/14/new:131:26: error: declaration of 'operator new' as non-function
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:131:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
131 | _GLIBCXX_NODISCARD void* operator new(std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
In file included from /usr/include/wchar.h:35,
from /usr/include/c++/14/cwchar:44,
from /usr/include/c++/14/bits/postypes.h:40:
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:132:41: error: attributes after parenthesized initializer ignored [-fpermissive]
132 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:133:26: error: declaration of 'operator new []' as non-function
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~~~
/usr/include/c++/14/new:133:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW (std::bad_alloc)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:134:41: error: attributes after parenthesized initializer ignored [-fpermissive]
134 | __attribute__((__externally_visible__));
| ^
/usr/include/c++/14/new:140:29: error: 'std::size_t' has not been declared
140 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:142:31: error: 'std::size_t' has not been declared
142 | void operator delete[](void*, std::size_t) _GLIBCXX_USE_NOEXCEPT
| ^~~
/usr/include/c++/14/new:145:26: error: declaration of 'operator new' as non-function
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:145:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:145:52: error: expected primary-expression before 'const'
145 | _GLIBCXX_NODISCARD void* operator new(std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:147:26: error: declaration of 'operator new []' as non-function
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/c++/14/new:147:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:147:54: error: expected primary-expression before 'const'
147 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
| ^~~~~
/usr/include/c++/14/new:154:26: error: declaration of 'operator new' as non-function
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:154:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:154:68: error: expected primary-expression before ')' token
154 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:155:73: error: attributes after parenthesized initializer ignored [-fpermissive]
155 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:156:26: error: declaration of 'operator new' as non-function
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:156:44: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:156:68: error: expected primary-expression before ',' token
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:156:70: error: expected primary-expression before 'const'
156 | _GLIBCXX_NODISCARD void* operator new(std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:162:26: error: declaration of 'operator new []' as non-function
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~~~
/usr/include/c++/14/new:162:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:162:70: error: expected primary-expression before ')' token
162 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t)
| ^
/usr/include/c++/14/new:163:73: error: attributes after parenthesized initializer ignored [-fpermissive]
163 | __attribute__((__externally_visible__, __alloc_size__ (1), __malloc__));
| ^
/usr/include/c++/14/new:164:26: error: declaration of 'operator new []' as non-function
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~~~
/usr/include/c++/14/new:164:46: error: 'size_t' is not a member of 'std'; did you mean 'size_t'?
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~~
/usr/lib/gcc/x86_64-linux-gnu/14/include/stddef.h:214:23: note: 'size_t' declared here
214 | typedef __SIZE_TYPE__ size_t;
| ^~~~~~
/usr/include/c++/14/new:164:70: error: expected primary-expression before ',' token
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^
/usr/include/c++/14/new:164:72: error: expected primary-expression before 'const'
164 | _GLIBCXX_NODISCARD void* operator new[](std::size_t, std::align_val_t, const std::nothrow_t&)
| ^~~~~
/usr/include/c++/14/new:171:29: error: 'std::size_t' has not been declared
171 | void operator delete(void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:173:31: error: 'std::size_t' has not been declared
173 | void operator delete[](void*, std::size_t, std::align_val_t)
| ^~~
/usr/include/c++/14/new:179:33: error: declaration of 'operator new' as non-function
179 | _GLIBCXX_NODISCARD inline void* operator new(std::size_t, void* __p) _GLIBCXX_USE_NOEXCEPT
| ^~~~~~~~
/usr/include/ |
s237829669 | p03866 | C++ | #include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <numeric>
#include <cassert>
#include <cmath>
#include <map>
#include <set>
using namespace std;
typedef unsigned int uint;
typedef long long LL;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> PII;
typedef vector<PII > VPII;
typedef vector<VPII> VVPII;
#define FOR(k,a,b) for(int k(a); k < (b); ++k)
#define REP(k,a) for(int k=0; k < (a); ++k)
#define ABS(a) ((a)>0?(a):-(a))
long double calcDist(LL x, LL y, LL r, LL x2, LL y2, LL r2)
{
LL d = (x - x2)*(x - x2) + (y - y2)*(y - y2);
long double res = sqrt((long double) d);
return max(res - r - r2,0);
}
int main(int argc, char** argv) {
#ifdef HOME
freopen("in.txt", "rb", stdin);
freopen("out.txt", "wb", stdout);
#endif
int x1, x2, y1, y2, N;
scanf("%d %d %d %d %d", &x1, &y1, &x2, &y2,&N);
vector<int> x(N+2), y(N+2), r(N+2);
REP(i, N)
{
scanf("%d %d %d", &x[i], &y[i], &r[i]);
}
x[N] = x1, y[N] = y1, x[N + 1] = x2, y[N + 1] = y2;
vector<vector<long double > > dist(N + 2,vector<long double>(N+2) );
REP(i, N+2) REP(j,N+2)
{
dist[i][j] = calcDist(x[i], y[i], r[i], x[j], y[j], r[j]);
}
const long double INF = 1e11;
vector<long double> d(N+2,INF);
set<pair<long double, int > > Q;
d[N] = 0;
Q.insert(make_pair(0, N));
while(!Q.empty())
{
long double actd = Q.begin()->first;
int act = Q.begin()->second;
Q.erase(Q.begin());
REP(i, N + 2)
{
long double nd = actd + dist[act][i];
if (d[i] > nd)
{
if (d[i] != INF)
{
Q.erase(make_pair(d[i], i));
}
d[i] = nd;
Q.insert(make_pair(nd, i));
}
}
}
printf("%.10f\n", d[N + 1]);
return 0;
} | a.cc: In function 'long double calcDist(LL, LL, LL, LL, LL, LL)':
a.cc:31:19: error: no matching function for call to 'max(long double, int)'
31 | return max(res - r - r2,0);
| ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:31:19: note: deduced conflicting types for parameter 'const _Tp' ('long double' and 'int')
31 | return max(res - r - r2,0);
| ~~~^~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:31:19: note: mismatched types 'std::initializer_list<_Tp>' and 'long double'
31 | return max(res - r - r2,0);
| ~~~^~~~~~~~~~~~~~~~
|
s462021858 | p03867 | C++ | ll N,K,M;
ll mo=1000000007;
vector<ll> V;
ll dp[2020];
ll modpow(ll a, ll n = mo-2) {
ll r=1;
while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1;
return r;
}
vector<ll> enumdiv(ll n) {
vector<ll> S;
for(ll i=1;i*i<=n;i++) if(n%i==0) {S.push_back(i); if(i*i!=n) S.push_back(n/i); }
sort(S.begin(),S.end());
return S;
}
void solve() {
int i,j,k,l,r,x,y; string s;
cin>>N>>K;
V=enumdiv(N);
M=V.size();
ll ret=0;
FOR(x,M) {
dp[x] = modpow(K,(V[x]+1)/2);
FOR(y,x) if(V[x]%V[y]==0) dp[x] += mo - dp[y];
dp[x] %= mo;
if(V[x]%2==0) {
ret += dp[x]*V[x]/2;
}
else {
ret += dp[x]*V[x];
}
}
cout<<ret%mo<<endl;
} | a.cc:1:1: error: 'll' does not name a type
1 | ll N,K,M;
| ^~
a.cc:2:1: error: 'll' does not name a type
2 | ll mo=1000000007;
| ^~
a.cc:3:1: error: 'vector' does not name a type
3 | vector<ll> V;
| ^~~~~~
a.cc:4:1: error: 'll' does not name a type
4 | ll dp[2020];
| ^~
a.cc:6:1: error: 'll' does not name a type
6 | ll modpow(ll a, ll n = mo-2) {
| ^~
a.cc:12:1: error: 'vector' does not name a type
12 | vector<ll> enumdiv(ll n) {
| ^~~~~~
a.cc: In function 'void solve()':
a.cc:20:28: error: 'string' was not declared in this scope
20 | int i,j,k,l,r,x,y; string s;
| ^~~~~~
a.cc:22:9: error: 'cin' was not declared in this scope
22 | cin>>N>>K;
| ^~~
a.cc:22:14: error: 'N' was not declared in this scope
22 | cin>>N>>K;
| ^
a.cc:22:17: error: 'K' was not declared in this scope
22 | cin>>N>>K;
| ^
a.cc:24:9: error: 'V' was not declared in this scope
24 | V=enumdiv(N);
| ^
a.cc:24:11: error: 'enumdiv' was not declared in this scope; did you mean 'enum'?
24 | V=enumdiv(N);
| ^~~~~~~
| enum
a.cc:25:9: error: 'M' was not declared in this scope
25 | M=V.size();
| ^
a.cc:27:9: error: 'll' was not declared in this scope; did you mean 'l'?
27 | ll ret=0;
| ^~
| l
a.cc:28:9: error: 'FOR' was not declared in this scope
28 | FOR(x,M) {
| ^~~
a.cc:40:9: error: 'cout' was not declared in this scope
40 | cout<<ret%mo<<endl;
| ^~~~
a.cc:40:15: error: 'ret' was not declared in this scope
40 | cout<<ret%mo<<endl;
| ^~~
a.cc:40:19: error: 'mo' was not declared in this scope
40 | cout<<ret%mo<<endl;
| ^~
a.cc:40:23: error: 'endl' was not declared in this scope
40 | cout<<ret%mo<<endl;
| ^~~~
|
s852411197 | p03867 | C++ | #include<bits/stdc++.h>
using namespace std;
const int MOD = int(1e9) + 7;
using lint = long long;
struct modint {
int v;
modint(lint v_ = 0): v(v_ % MOD) { }
modint operator+ (const modint &m) const {
return modint(v + m.v);
}
modint operator- (const modint &m) const {
return modint(v - m.v + MOD);
}
modint operator* (const modint &m) const {
return modint((lint)v * m.v);
}
modint operator+= (const modint &m) {
v = (v + m.v) % MOD;
return *this;
}
modint operator*= (const modint &m) {
v = ((lint)v * m.v) % MOD;
return *this;
}
modint operator-= (const modint &m) {
v = (v - m.v + MOD) % MOD;
return *this;
}
modint pow(int k) {
modint cur(v), ret(1);
while(k > 0) {
if(k & 1) ret *= cur;
cur = cur * cur;
k >>= 1;
}
return ret;
}
modint inv() {
return pow(MOD - 2);
}
};
const modint INV2 = modint(2).inv();
int N, K;
modint ans;
modint ways[int(5.1e4)];
int main() {
scanf("%d%d", &N, &K);
vector<int> divs;
for(int i = 1; i * i <= N; i++) {
if(N % i == 0) {
divs.push_back(i);
if(i * i != N) divs.push_back(N/i);
}
}
sort(divs.begin(), divs.end());
for(int i = 0; i < int(divs.size()); i++) {
// degree of freedom : divs[i]
ways[i] += modint(K).pow((divs[i] + 1) / 2);
for(int j = 0; j < i; j++) if(divs[i] % divs[j] == 0) ways[i] -= ways[j];
ans += (divs[i] % 2 == 1 ? modint(1) : INV2) * ways[i] * divs[i];
}
printf("%d\n", ans.v);
return 0;
}
/*
N이 홀수
ABCBA => A, B, C 중 하나라도 다르면 서로 다른 수열을 얻음
BCBAA -> B=A, C=A -> 전부 같아야
CBAAB -> C=B=A
BAABC -> B=C=A
AABCB -> A=B=C
염려:
DEFED
EFEDD
FEDDE
EDDEF
DDEFE
N이 짝수 -> A, B, C가 하나라도 다르면 서로 다른 palin 수열 2개가 같은 결과
ABCCBA
BCCBAA B=A=C
CCBAAB C=B=A
CBAABC (palin!)
BAABCC B=C=A
AABCCB A=B=C
*/ac | a.cc:107:3: error: 'ac' does not name a type
107 | */ac
| ^~
|
s614522907 | p03867 | C++ | #include<algorithm>
#include<cstring>
#include<cctype>
#include<cstdio>
#define rep(i,x,y) for(int i=x; i<=y; ++i)
using namespace std;
const int N=10005,mod=1000000007;
int n,k,prm[N],c[N],a[N],tot;
typedef long long LL;
LL ret,ans;
LL getmi(LL a,LL x)
{
LL rt=1;
while(x)
{
if(x&1) rt=rt*a%mod;
a=a*a%mod,x>>=1;
}
return rt;
}
void dfs2(int x,int d,int val)
{
if(x>tot)
{
if(d&1) ret=(ret+d*getmi(k,(d/val+1)/2))%mod;
else ret=(ret+d/2*getmi(k,(d/val+1)/2))%mod;
return;
}
int nw=a[x]?prm[x]:1;
rep(i,a[x],c[x]) dfs2(x+1,d*nw,val),nw*=prm[x];
}
void dfs1(int x,int mu,int val)
{
if(x>tot)
{
ret=0,dfs2(1,1,val);
ans=(ans+mu*ret)%mod;
return;
}
a[x]=0,dfs1(x+1,mu,val);
a[x]=1,dfs1(x+1,-mu,val*prm[x]);
}
int main()
{
scanf("%d%d",&n,&k);
int x=n,lim=sqrt(n);
rep(i,2,lim) if(x%i==0)
{
prm[++tot]=i;
while(x%i==0) x/=i,++c[tot];
}
if(x>1) prm[++tot]=x,c[tot]=1;
dfs1(1,1,1);
printf("%lld\n",(ans+mod)%mod);
return 0;
} | a.cc: In function 'int main()':
a.cc:51:21: error: 'sqrt' was not declared in this scope
51 | int x=n,lim=sqrt(n);
| ^~~~
|
s645673736 | p03867 | C++ | #include <iostream>
#include <vector>
using namespace std;
#define MOD 1000000007
long long bipow(long long K, int p){
if(p == 0) return 1;
if(p % 2 == 0){
long long tmp = (K * K) % MOD;
return bipow(tmp, p / 2) % MOD;
}else
return (K * bipow(K, p-1)) % MOD;
}
vector<long long> divs(int n){
vector<long long> ret;
for(int i=1; i*i<=n; i++){
if(n % i == 0){
ret.push_back(i);
if(i * i != n) ret.push_back(n / i);
}
}
return ret;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
long long N, K;
cin >> N >> K;
vector<long long> dv = divs(N);
sort(dv.begin(), dv.end());
vector<long long> num(dv.size(), 0);
num[0] = K;
for(int i=1; i<dv.size(); i++){
long long d = dv[i];
long long tmp1 = bipow(K, (d+1)/2);
long long tmp2 = 0;
for(int j=0; j<i; j++){
int d2 = dv[j];
if(d % d2 == 0) tmp2 = (tmp2 + num[j]) % MOD;
}
num[i] = (tmp1 - tmp2 + MOD) % MOD;
}
long long ans = 0;
for(int i=0; i<dv.size(); i++){
long long d = dv[i];
if(d % 2 == 0)
ans += (num[i] * d / 2) % MOD;
else
ans += (num[i] * d) % MOD;
ans %= MOD;
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:33:5: error: 'sort' was not declared in this scope; did you mean 'short'?
33 | sort(dv.begin(), dv.end());
| ^~~~
| short
|
s581081002 | p03867 | C++ | #pragma region include
#include <iostream>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <cstring>
#include <vector>
#include <tuple>
#include <bitset>
#include <queue>
#include <complex>
#include <set>
#include <map>
#include <stack>
#include <list>
#include <fstream>
#include <random>
//#include <time.h>
#include <ctime>
#pragma endregion //#include
/////////
#define REP(i, x, n) for(int i = x; i < n; ++i)
#define rep(i,n) REP(i,0,n)
/////////
#pragma region typedef
typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;
#pragma endregion //typedef
////定数
const int INF = (int)1e9;
const LL MOD = (LL)1e9+7;
const LL LINF = (LL)1e18;
const double PI = acos(-1.0);
const double EPS = 1e-9;
/////////
using namespace::std;
#pragma region
template<class T>
vector<T> getDivisor(T n){
vector<T> v;
for(int i=1;i*i<=n;++i){
if( n%i == 0 ){
v.push_back(i);
if( i != n/i ){//平方数で重複して数えないように
v.push_back(n/i);
}
}
}
sort(v.begin(), v.end());
return v;
}
#pragma endregion //約数列挙 getDivisor(n):O(√n)
void solve(){
cin >> N >> K;
dfs( N );
vector<LL> yaku = getDivisor(N);
int size = yaku.size();
LL ans = 0;
for(int i=0;i<size;++i){
if( yaku[i] & 1 ){//奇数長の最小周期
ans += (memo[ yaku[i] ]* yaku[i]);
}else{//偶数長の最小周期
/*
↓ここから回るABCCBA
ABC
ABC←ここから回るCBAABC
前半分を反転したものが後ろ半分になっている(偶数長の回文)
サイクリックシフトで前半分をすべて後ろに持っていくと
並びはそのままで後ろ半分の位置にくる。
後ろ半分も並び順はそのままで前にくる。
←→が→←の様にならぶ。
→←もまた最小周期の条件を満たす。?
サイクリックシフトで半分重複する。
←1←2 →2→1
→2→1 ←1←2
偶数長の周期があったとすると、それをつなげた
→2→1も周期性がある。
回文なので←1←2も周期性がある。
これは
←1←2 →2→1が最小周期の条件と矛盾するので
→2→1 ←1←2は偶数長の周期を持たない。
→2→1 ←1←2が奇数長の周期を持つとする。
元の長さが偶数なので、奇数長の周期が偶数個表れる。
よって→2→1は奇数周期の回文を繋げて構成されている。
同じ回文を繋げた文字列も回文なので
←1←2も回文で奇数長の周期を持つ。
←1←2 →2→1が奇数長の周期を持つ事になる。
←1←2 →2→1が内部に周期を持たない事と矛盾するので
→2→1 ←1←2は奇数長の周期を持たない。
→2→1 ←1←2は内部に周期を持たない。
*/
ans += (memo[ yaku[i] ]* yaku[i]/2);
}
ans %= MOD;
}
cout << ans << endl;
}
#pragma region main
signed main(void){
std::cin.tie(0);
std::ios::sync_with_stdio(false);
std::cout << std::fixed;//小数を10進数表示
cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別
solve();
}
#pragma endregion //main()
| a.cc: In function 'void solve()':
a.cc:65:16: error: 'N' was not declared in this scope
65 | cin >> N >> K;
| ^
a.cc:65:21: error: 'K' was not declared in this scope
65 | cin >> N >> K;
| ^
a.cc:66:9: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
66 | dfs( N );
| ^~~
| ffs
a.cc:74:33: error: 'memo' was not declared in this scope
74 | ans += (memo[ yaku[i] ]* yaku[i]);
| ^~~~
a.cc:107:33: error: 'memo' was not declared in this scope
107 | ans += (memo[ yaku[i] ]* yaku[i]/2);
| ^~~~
|
s855799820 | p03867 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int P = 1e9+7;
const int inv = 5e8+4;
int Pow(int a,int b){
if(b==0) return 1;
int ret = Pow(a,b>>1);
ret=1ll*ret*ret%P;
if(b&1) ret=1ll*ret*a%P;
return ret;
}
int n,K,ans,q[100000];
map<int,int> POW,F;
inline add(int &x,int y ){x=(x+y)%P;}
int main(){
cin>>n>>K;
int t,l;
for(int i=1;1ll*i*i<=n;i++) if(n%i==0){
//cout<<i<<endl;
POW[i] = Pow(K,(i+1)>>1);
t = n/i;
POW[t] = Pow(K,(t+1)>>1);
}
//cout<<POW[n]<<endl;
int cnt = 0;
for(int i=1;1ll*i*i<=n;i++) if(n%i==0){
//cout<<i<<endl;
t = i;
l = n/t;
add(F[t],POW[t]);
for(int j=2;1ll*j*j<=l;j++) if(l%j==0){
add(F[j*t],-F[t]);
if(j*j!=l) add(F[t*(l/j)],-1ll*F[t]%P);
}
if(n!=t) add(F[n],-1ll*F[t]%P);
if(t&1) add(ans,1ll*F[t]*t%P);
else add(ans,1ll*t*F[t]%P*inv%P);
if(i*i!=n)q[++cnt] = n/i;
}
//cout<<"YYY"<<endl;
for(int i=cnt;i>0;i--){
t = q[i];
l = n/t;
add(F[t],POW[t]);
for(int j=2;1ll*j*j<=l;j++) if(l%j==0){
add(F[j*t],-F[t]);
if(j*j!=l) add(F[t*(l/j)],-1ll*F[t]%P);
}
if(n!=t) add(F[n],-1ll*F[t]%P);
//add(ans,1ll*F[t]*t%P);
//if(t!=n) add(ans,1ll*F[t]*t%P);
//else {
if(t&1) add(ans,1ll*F[t]*t%P);
else add(ans,1ll*F[t]*t%P*inv%P);
//}
}
ans =(ans+P)%P;
cout<<ans<<endl;
return 0;
} | a.cc:15:8: error: ISO C++ forbids declaration of 'add' with no type [-fpermissive]
15 | inline add(int &x,int y ){x=(x+y)%P;}
| ^~~
a.cc: In function 'int add(int&, int)':
a.cc:15:37: warning: no return statement in function returning non-void [-Wreturn-type]
15 | inline add(int &x,int y ){x=(x+y)%P;}
| ^
|
s643044895 | p03867 | C++ | #include <cstdio>
#include <cmath>
#include <vector>
#include <map>
typedef long long signed int LL;
typedef long long unsigned int LU;
#define incID(i, l, r) for(int i = (l) ; i < (r); i++)
#define incII(i, l, r) for(int i = (l) ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r) ; i >= (l); i--)
#define inc( i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec( i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) < (r))
template<typename T> void swap(T & x, T & y) { T t = x; x = y; y = t; return; }
template<typename T> T abs(T x) { return (0 <= x ? x : -x); }
template<typename T> T max(T a, T b) { return (b <= a ? a : b); }
template<typename T> T min(T a, T b) { return (a <= b ? a : b); }
template<typename T> bool setmin(T & a, T b) { if(a <= b) { return false; } else { a = b; return true; } }
template<typename T> bool setmax(T & a, T b) { if(b <= a) { return false; } else { a = b; return true; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
// ---- ----
LL n, k;
bool c[40000];
LL p[20], e[20], pn;
const LL MOD = 1000000007;
std::vector<LL> div;
std::map<LL, LL> mu, gg;
LL ans;
LL g(LL x) {
LL ex = (x + 1) / 2;
LL ans = 1, prod = k;
while(ex) {
if(ex & 1) { (ans *= prod) %= MOD; }
(prod *= prod) %= MOD;
ex /= 2;
}
return ans;
}
int main() {
scanf("%lld%lld", &n, &k);
for(LL i = 2; i * i > 1000000000; i++) {
if(c[i]) { continue; }
for(LL j = i * 2; j < 40000; j += i) { c[j] = true; }
}
LL nn = n;
incID(i, 2, 40000) {
if(! c[i] && nn % i == 0) {
p[pn] = i;
while(nn % i == 0) {
e[pn]++;
nn /= i;
}
pn++;
}
}
if(nn != 1) {
p[pn] = nn;
e[pn] = 1;
pn++;
}
LL count[21];
inc(i, pn) { count[i] = 0; }
while(true) {
LL num = 1, prod = 1;
inc(i, pn) {
inc(j, count[i]) {
if(j == 0) { num *= -1; } else { num = 0; }
(prod *= p[i]) %= MOD;
}
}
div.push_back(prod);
mu[prod] = num;
int i = 0;
while(count[i] == e[i]) { count[i++] = 0; }
if(i == pn) { break; } else { count[i]++; }
}
for(auto && e : div) { gg[e] = g(e); }
for(auto && x : div) {
for(auto && t : div) {
if(t % x == 0) {
(ans += mu[t / x] * (t % 2 == 0 ? t / 2 : t) * gg[x]) %= MOD;
}
}
}
printf("%lld\n", ans);
return 0;
}
| a.cc:37:17: error: 'std::vector<long long int> div' redeclared as different kind of entity
37 | std::vector<LL> div;
| ^~~
In file included from /usr/include/c++/14/bits/std_abs.h:38,
from /usr/include/c++/14/cmath:49,
from a.cc:2:
/usr/include/stdlib.h:992:14: note: previous declaration 'div_t div(int, int)'
992 | extern div_t div (int __numer, int __denom)
| ^~~
a.cc: In function 'int main()':
a.cc:88:21: error: request for member 'push_back' in 'div', which is of non-class type 'div_t(int, int) noexcept'
88 | div.push_back(prod);
| ^~~~~~~~~
a.cc:96:25: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
96 | for(auto && e : div) { gg[e] = g(e); }
| ^~~
| std::begin
In file included from /usr/include/c++/14/vector:69,
from a.cc:4:
/usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here
114 | template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
| ^~~~~
a.cc:96:25: error: 'end' was not declared in this scope; did you mean 'std::end'?
96 | for(auto && e : div) { gg[e] = g(e); }
| ^~~
| std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
a.cc:98:25: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
98 | for(auto && x : div) {
| ^~~
| std::begin
/usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here
114 | template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
| ^~~~~
a.cc:98:25: error: 'end' was not declared in this scope; did you mean 'std::end'?
98 | for(auto && x : div) {
| ^~~
| std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
a.cc:99:25: error: 'begin' was not declared in this scope; did you mean 'std::begin'?
99 | for(auto && t : div) {
| ^~~
| std::begin
/usr/include/c++/14/bits/range_access.h:114:37: note: 'std::begin' declared here
114 | template<typename _Tp> const _Tp* begin(const valarray<_Tp>&) noexcept;
| ^~~~~
a.cc:99:25: error: 'end' was not declared in this scope; did you mean 'std::end'?
99 | for(auto && t : div) {
| ^~~
| std::end
/usr/include/c++/14/bits/range_access.h:116:37: note: 'std::end' declared here
116 | template<typename _Tp> const _Tp* end(const valarray<_Tp>&) noexcept;
| ^~~
|
s594158268 | p03867 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <set>
#include <map>
#include <unordered_map>
#include <vector>
#include <queue>
#include <string>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <random>
#include <chrono>
#include <bitset>
#include <fstream>
#include <sstream>
using namespace std;
using namespace std::chrono;
/*
#define trav(a, v) for(auto& a : v)
#define all(x) x.begin(), x.end()
#define rep(i, a, b) for(int i = a; i < (b); ++i)
*/
typedef long long ll;
typedef long double ld;
ll big = 1000000007ll;
ll n,m,k,r;
ll mob(ll i){
if(i == 1)return 1;
for(ll c1 = 2; c1*c1 <= i; c1++){
if(i % c1 == 0){
if(i % (c1*c1) == 0)return 0;
return (-1) * mob(i / c1);
}
}
return -1;
}
ll ans = 0;
ll upp(ll i, ll j){
if(j == 0)return 1;
if(j%2 == 0){
ll h = upp(i,j/2);
return (h*h)%big;
}
return (i*upp(i,j-1))%big;
}
ll g(ll i){
ll a = mob(n/i) * upp(k, (n+1)/2);
a += big;
a %= big;
if(i % 2 == 0){a *= i/2;}
else{
a *= i;
}
a%=big;
return a;
}
ll f(ll i){
for()
}
int main()
{
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
ll c1,c2,c3,c4,c5,c6;
ll a,b,c,e;
ll x;
cin >> n >> k;
for(ll c1 = 1; c1*c1 <= n; c1++){
if(n%c1 == 0){
ans += g(c1);
ans += big;
ans %= big;
if(c1*c1 != n){
ans += g(n/c1);
ans += big;
ans %= big;
}
}
}
cout << ans << "\n";
return 0;
} | a.cc: In function 'll f(ll)':
a.cc:81:9: error: expected primary-expression before ')' token
81 | for()
| ^
a.cc:84:1: error: expected primary-expression before '}' token
84 | }
| ^
a.cc:81:10: error: expected ';' before '}' token
81 | for()
| ^
| ;
......
84 | }
| ~
a.cc:84:1: error: expected primary-expression before '}' token
84 | }
| ^
a.cc:81:10: error: expected ')' before '}' token
81 | for()
| ~ ^
| )
......
84 | }
| ~
a.cc:84:1: error: expected primary-expression before '}' token
84 | }
| ^
a.cc:84:1: warning: no return statement in function returning non-void [-Wreturn-type]
|
s956779494 | p03868 | C++ | #include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
void chmax(ll a, ll b) {if(a<b) a=b;}
void chmin(ll a, ll b) {if(a>b) a=b;}
ll max(ll a, ll b) {return a>b ? a:b;}
ll min(ll a, ll b) {return a<b ? a:b;}
ll moP(ll x, ll n) {
ll res=1;
while(n>0) {
if(n&1) moC(res, *, x);
moC(x, *, x);
n>>=1;
}
return res;
}
int main(void) {
ll N;
cin >> N;
P p[MAX*2];
ll i;
ll fa[MAX];
fa[0]=1;
for(i=1; i<MAX; i++)
fa[i]=i*fa[i-1]%MOD;
for(i=0; i<N; i++) {
cin >> p[i].ft;
p[i].sc=0;
}
for(i=N; i<2*N; i++) {
cin >> p[i].ft;
p[i].sc=1;
}
sort(p, p+2*N);
ll ans=1;
stack<ll> st;
for(i=0; i<2*N; i++) {
if(st.size()==0) st.push(p[i].sc);
else if(st.top()==p[i].sc) st.push(p[i].sc);
else {
ll t=0;
while(st.size()!=0 && st.top()!=p[i].sc) {
t++;
i++;
st.pop();
}
st.push(p[i].sc)
moC(ans, *, fa[t]);
}
}
pt(ans);
}
| a.cc: In function 'int main()':
a.cc:66:20: error: void value not ignored as it ought to be
66 | st.push(p[i].sc)
| ~~~~~~~^~~~~~~~~
|
s688743119 | p03868 | C++ | #include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define pt(sth) cout << sth << "\n"
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;
void chmax(ll a, ll b) {if(a<b) a=b;}
void chmin(ll a, ll b) {if(a>b) a=b;}
ll max(ll a, ll b) {return a>b ? a:b;}
ll min(ll a, ll b) {return a<b ? a:b;}
ll moP(ll x, ll n) {
ll res=1;
while(n>0) {
if(n&1) moC(res, *, x);
moC(x, *, x);
n>>=1;
}
return res;
}
int main(void) {
ll N;
cin >> N;
P p[MAX*2];
ll i;
ll fa[MAX];
fa[0]=1;
for(i=1; i<MAX; i++)
fa[i]=i*fa[i-1]%MOD;
for(i=0; i<N; i++) {
cin >> p[i].ft;
p[i].sc=0;
}
for(i=N; i<2*N; i++) {
cin >> p[i].ft;
p[i].sc=1;
}
sort(p, p+2*N);
ll ans=1;
stack<ll> st;
for(i=0; i<2*N; i++) {
if(st.size()==0) st.push(p[i].sc);
else if(st.top()==p[i].sc) st.push(p[i].sc);
else {
ll t=0;
while(st.size()!=0 && st.top()!=p[i].sc) {
t++;
i++;
st.pop();
}
st.push(p[i].sc)
moC(ans, *, fa[t]);
}
}
pt(ans);
}
| a.cc: In function 'int main()':
a.cc:66:20: error: void value not ignored as it ought to be
66 | st.push(p[i].sc)
| ~~~~~~~^~~~~~~~~
|
s829472337 | p03868 | C++ | w#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;
template<typename tp> inline void read(tp &x) {
x = 0; char c = getchar(); int f = 0;
for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
if (f) x = -x;
}
#define pb push_back
#define int long long
typedef long long lo;
const int N = 3e5 + 233;
const int mo = 1e9 + 7;
int n, a[N], b[N], fac[N];
inline int sgn(int x) {
return x > 0 ? 1 : -1;
}
signed main(void) {
read(n);
rep (i, n) read(a[i]);
rep (i, n) read(b[i]);
sort(a + 1, a + n + 1);
sort(b + 1, b + n + 1);
fac[0] = 1;
rep (i, n) fac[i] = fac[i - 1] * i % mo;
int posA = n, posB = 0;
for (int i = 2; i <= n; i ++) {
if (abs(a[i] - b[i]) + abs(a[i - 1] - b[i - 1])
!= abs(a[i] - b[i - 1]) + abs(a[i - 1] - b[i])) {
posA = i - 1;
break;
}
}
for (int i = n; i >= 1; i --) {
if (abs(a[i] - b[i]) + abs(a[i - 1] - b[i - 1])
!= abs(a[i] - b[i - 1]) + abs(a[i - 1] - b[i])) {
posB = n - i;
break;
}
}
// cout << posA << " " << posB << "\n";
cout << fac[posA] * fac[posB] % mo << "\n";
}
| a.cc:1:2: error: stray '#' in program
1 | w#include <bits/stdc++.h>
| ^
a.cc:1:1: error: 'w' does not name a type
1 | w#include <bits/stdc++.h>
| ^
a.cc: In function 'void read(tp&)':
a.cc:9:19: error: there are no arguments to 'getchar' that depend on a template parameter, so a declaration of 'getchar' must be available [-fpermissive]
9 | x = 0; char c = getchar(); int f = 0;
| ^~~~~~~
a.cc:9:19: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc:10:49: error: there are no arguments to 'getchar' that depend on a template parameter, so a declaration of 'getchar' must be available [-fpermissive]
10 | for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
| ^~~~~~~
a.cc:11:71: error: there are no arguments to 'getchar' that depend on a template parameter, so a declaration of 'getchar' must be available [-fpermissive]
11 | for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:28:8: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
28 | rep (i, n) read(a[i]);
| ^
a.cc:2:29: note: in definition of macro 'rep'
2 | #define rep(i, n) for (rint i = 1; i <= (n); i ++)
| ^
a.cc:29:8: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
29 | rep (i, n) read(b[i]);
| ^
a.cc:2:29: note: in definition of macro 'rep'
2 | #define rep(i, n) for (rint i = 1; i <= (n); i ++)
| ^
a.cc:30:3: error: 'sort' was not declared in this scope; did you mean 'short'?
30 | sort(a + 1, a + n + 1);
| ^~~~
| short
a.cc:33:8: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
33 | rep (i, n) fac[i] = fac[i - 1] * i % mo;
| ^
a.cc:2:29: note: in definition of macro 'rep'
2 | #define rep(i, n) for (rint i = 1; i <= (n); i ++)
| ^
a.cc:36:9: error: 'abs' was not declared in this scope
36 | if (abs(a[i] - b[i]) + abs(a[i - 1] - b[i - 1])
| ^~~
a.cc:43:9: error: 'abs' was not declared in this scope
43 | if (abs(a[i] - b[i]) + abs(a[i - 1] - b[i - 1])
| ^~~
a.cc:50:3: error: 'cout' was not declared in this scope
50 | cout << fac[posA] * fac[posB] % mo << "\n";
| ^~~~
a.cc: In instantiation of 'void read(tp&) [with tp = long long int]':
a.cc:27:7: required from here
27 | read(n);
| ~~~~^~~
a.cc:9:26: error: 'getchar' was not declared in this scope
9 | x = 0; char c = getchar(); int f = 0;
| ~~~~~~~^~
a.cc:1:1: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | w#include <bits/stdc++.h>
|
s547627019 | p03868 | C++ | w#include <bits/stdc++.h>
#define rep(i, n) for (rint i = 1; i <= (n); i ++)
#define re0(i, n) for (rint i = 0; i < (int) n; i ++)
#define travel(i, u) for (rint i = head[u]; i; i = e[i].nxt)
#define rint register int
using namespace std;
template<typename tp> inline void read(tp &x) {
x = 0; char c = getchar(); int f = 0;
for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
if (f) x = -x;
}
#define pb push_back
#define int long long
typedef long long lo;
const int N = 3e5 + 233;
const int mo = 1e9 + 7;
int n, a[N], b[N], fac[N];
inline int sgn(int x) {
return x > 0 ? 1 : -1;
}
signed main(void) {
read(n);
rep (i, n) read(a[i]);
rep (i, n) read(b[i]);
sort(a + 1, a + n + 1);
sort(b + 1, b + n + 1);
fac[0] = 1;
rep (i, n) fac[i] = fac[i - 1] * i % mo;
int posA = n, posB = 0;
for (int i = 2; i <= n; i ++) {
if (abs(a[i] - b[i]) + abs(a[i - 1] - b[i - 1])
!= abs(a[i] - b[i - 1]) + abs(a[i - 1] - b[i])) {
posA = i - 1;
break;
}
}
for (int i = n; i >= 1; i --) {
if (abs(a[i] - b[i]) + abs(a[i - 1] - b[i - 1])
!= abs(a[i] - b[i - 1]) + abs(a[i - 1] - b[i])) {
posB = n - i;
break;
}
}
// cout << posA << " " << posB << "\n";
cout << fac[posA] * fac[posB] % mo << "\n";
}
| a.cc:1:2: error: stray '#' in program
1 | w#include <bits/stdc++.h>
| ^
a.cc:1:1: error: 'w' does not name a type
1 | w#include <bits/stdc++.h>
| ^
a.cc: In function 'void read(tp&)':
a.cc:9:19: error: there are no arguments to 'getchar' that depend on a template parameter, so a declaration of 'getchar' must be available [-fpermissive]
9 | x = 0; char c = getchar(); int f = 0;
| ^~~~~~~
a.cc:9:19: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc:10:49: error: there are no arguments to 'getchar' that depend on a template parameter, so a declaration of 'getchar' must be available [-fpermissive]
10 | for (; c < '0' || c > '9'; f |= c == '-', c = getchar());
| ^~~~~~~
a.cc:11:71: error: there are no arguments to 'getchar' that depend on a template parameter, so a declaration of 'getchar' must be available [-fpermissive]
11 | for (; c >= '0' && c <= '9'; x = (x << 3) + (x << 1) + c - '0', c = getchar());
| ^~~~~~~
a.cc: In function 'int main()':
a.cc:28:8: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
28 | rep (i, n) read(a[i]);
| ^
a.cc:2:29: note: in definition of macro 'rep'
2 | #define rep(i, n) for (rint i = 1; i <= (n); i ++)
| ^
a.cc:29:8: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
29 | rep (i, n) read(b[i]);
| ^
a.cc:2:29: note: in definition of macro 'rep'
2 | #define rep(i, n) for (rint i = 1; i <= (n); i ++)
| ^
a.cc:30:3: error: 'sort' was not declared in this scope; did you mean 'short'?
30 | sort(a + 1, a + n + 1);
| ^~~~
| short
a.cc:33:8: warning: ISO C++17 does not allow 'register' storage class specifier [-Wregister]
33 | rep (i, n) fac[i] = fac[i - 1] * i % mo;
| ^
a.cc:2:29: note: in definition of macro 'rep'
2 | #define rep(i, n) for (rint i = 1; i <= (n); i ++)
| ^
a.cc:36:9: error: 'abs' was not declared in this scope
36 | if (abs(a[i] - b[i]) + abs(a[i - 1] - b[i - 1])
| ^~~
a.cc:43:9: error: 'abs' was not declared in this scope
43 | if (abs(a[i] - b[i]) + abs(a[i - 1] - b[i - 1])
| ^~~
a.cc:50:3: error: 'cout' was not declared in this scope
50 | cout << fac[posA] * fac[posB] % mo << "\n";
| ^~~~
a.cc: In instantiation of 'void read(tp&) [with tp = long long int]':
a.cc:27:7: required from here
27 | read(n);
| ~~~~^~~
a.cc:9:26: error: 'getchar' was not declared in this scope
9 | x = 0; char c = getchar(); int f = 0;
| ~~~~~~~^~
a.cc:1:1: note: 'getchar' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | w#include <bits/stdc++.h>
|
s612862996 | p03868 | C++ | #include <iostream>
#include <vector>
using namespace std;
const long long mod = 1e9 + 7;
int main(void){
int n;
cin >> n;
vector<pair<int, int> > a;
for (int i = 0; i < n; ++i){
int p;
cin >> p;
a.push_back(make_pair(p, 0));
}
for (int i = 0; i < n; ++i){
int p;
cin >> p;
a.push_back(make_pair(p, 1));
}
sort(a.begin(), a.end());
long long ans = 1, x = 0, y = 0;
for (int i = 0; i < 2 * n; ++i){
if (a[i].second == 0){
if (y){
ans = (ans * y) % mod;
y--;
}else{
x++;
}
}else{
if (x){
ans = (ans * x) % mod;
x--;
}else{
y++;
}
}
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:22:5: error: 'sort' was not declared in this scope; did you mean 'short'?
22 | sort(a.begin(), a.end());
| ^~~~
| short
|
s956608268 | p03868 | C++ | aaa | a.cc:1:1: error: 'aaa' does not name a type
1 | aaa
| ^~~
|
s553301219 | p03869 | C++ | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define MOD 1000000007
#define INF 1 << 30
using namespace std;
typedef long long ll;
int main(void) {
int ax, ay, bx, by, cx, cy;
double S, r, a, b, c, m = 0.0, ans = 0.0;
cin >> ax >> ay >> bx >> by >> cx >> cy;
bx -= cx;
by -= cy;
ax -= cx;
ay -= cy;
cx = cy = 0;
S = abs(ax * by - bx * ay);
a = sqrt(abs(ax - bx) * abs(ax - bx) + abs(ay - by) * abs(ay - by));
b = sqrt(abs(ax - cx) * abs(ax - cx) + abs(ay - cy) * abs(ay - cy));
c = sqrt(abs(cx - bx) * abs(cx - bx) + abs(cy - by) * abs(cy - by));
r = S / (a + b + c);
a = max(a, max(b, c));
ans = a * r / (2.0 * r + a);
printf("%.10lf\n", ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:21:13: error: 'sqrt' was not declared in this scope
21 | a = sqrt(abs(ax - bx) * abs(ax - bx) + abs(ay - by) * abs(ay - by));
| ^~~~
|
s296560319 | p03869 | C++ | #include<iostream>
#include<algorithm>
#include<iomanip>
#include<set>
#define DB double
DB x[3], y[3];
DB M, G[3];
DB s;
DB pow(DB n) { return n * n; }
int main() {
for (int i = 0; i < 3; i++) {
std::cin >> x[i] >> y[i];
}
for (int i = 0; i < 3; i++) {
G[i] = std::hypot(x[i] - x[(i + 1) % 3],y[i] - y[(i + 1) % 3]);
M = std::max(M, G[i]);
s += G[i];
}
s /= 2;
DB r = std::sqrt(s*(s - G[0])*(s - G[1])*(s - G[2]));
r /= s;
DB x = M * r;
x /= (2 * r + M);
std::cout <<std::fixed<<std::setprecision(12)<< x << std::endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:15:29: error: 'hypot' is not a member of 'std'
15 | G[i] = std::hypot(x[i] - x[(i + 1) % 3],y[i] - y[(i + 1) % 3]);
| ^~~~~
a.cc:20:21: error: 'sqrt' is not a member of 'std'; did you mean 'sort'?
20 | DB r = std::sqrt(s*(s - G[0])*(s - G[1])*(s - G[2]));
| ^~~~
| sort
|
s873702473 | p03869 | C++ | #include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=500000004;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
//const double EPS = 1e-10;
const double INF = 1e+10;
//const double PI = acos(-1);
int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
inline double ABS(double a){return max(a,-a);}
struct Pt {
double x, y;
Pt() {}
Pt(double x, double y) : x(x), y(y) {}
Pt operator+(const Pt &a) const { return Pt(x + a.x, y + a.y); }
Pt operator-(const Pt &a) const { return Pt(x - a.x, y - a.y); }
Pt operator*(const Pt &a) const { return Pt(x * a.x - y * a.y, x * a.y + y * a.x); }
Pt operator-() const { return Pt(-x, -y); }
Pt operator*(const double &k) const { return Pt(x * k, y * k); }
Pt operator/(const double &k) const { return Pt(x / k, y / k); }
double ABS() const { return sqrt(x * x + y * y); }
double abs2() const { return x * x + y * y; }
double arg() const { return atan2(y, x); }
double dot(const Pt &a) const { return x * a.x + y * a.y; }
double det(const Pt &a) const { return x * a.y - y * a.x; }
};
double tri(const Pt &a, const Pt &b, const Pt &c) { return (b - a).det(c - a); }
int iSP(Pt a, Pt b, Pt c) {
int s = sig((b - a).det(c - a));
if (s) return s;
if (sig((b - a).dot(c - a)) < 0) return -2; // c-a-b
if (sig((a - b).dot(c - b)) < 0) return +2; // a-b-c
return 0;
}
int iLL(Pt a, Pt b, Pt c, Pt d) {
if (sig((b - a).det(d - c))) return 1; // intersect
if (sig((b - a).det(c - a))) return 0; // parallel
return -1; // correspond
}
bool iLS(Pt a, Pt b, Pt c, Pt d) {
return (sig(tri(a, b, c)) * sig(tri(a, b, d)) <= 0);
}
bool iSS(Pt a, Pt b, Pt c, Pt d) {
return (iSP(a, b, c) * iSP(a, b, d) <= 0 && iSP(c, d, a) * iSP(c, d, b) <= 0);
}
bool iSSstrict(Pt a, Pt b, Pt c, Pt d) {
return (sig(tri(a, b, c)) * sig(tri(a, b, d)) < 0 && sig(tri(c, d, a)) * sig(tri(c, d, b)) < 0);
}
Pt pLL(Pt a, Pt b, Pt c, Pt d) {
b = b - a; d = d - c; return a + b * (c - a).det(d) / b.det(d);
}
Pt hLP(Pt a,Pt b,Pt c){
return pLL(a,b,c,c+(b-a)*Pt(0,1));
}
double dLP(Pt a, Pt b, Pt c) {
return ABS(tri(a, b, c)) / (b - a).ABS();
}
double dSP(Pt a, Pt b, Pt c) {
if (sig((b - a).dot(c - a)) <= 0) return (c - a).ABS();
if (sig((a - b).dot(c - b)) <= 0) return (c - b).ABS();
return ABS(tri(a, b, c)) / (b - a).ABS();
}
double dLL(Pt a, Pt b, Pt c, Pt d) {
return iLL(a, b, c, d) ? 0 : dLP(a, b, c);
}
double dLS(Pt a, Pt b, Pt c, Pt d) {
return iLS(a, b, c, d) ? 0 : min(dLP(a, b, c), dLP(a, b, d));
}
double dSS(Pt a, Pt b, Pt c, Pt d) {
return iSS(a, b, c, d) ? 0 : min(min(dSP(a, b, c), dSP(a, b, d)), min(dSP(c, d, a), dSP(c, d, b)));
}
int sGP(int n, Pt p[], Pt a) {
int side = -1, i;
p[n] = p[0];
for (i = 0; i < n; ++i) {
Pt p0 = p[i] - a, p1 = p[i + 1] - a;
if (sig(p0.det(p1)) == 0 && sig(p0.dot(p1)) <= 0) return 0;
if (p0.y > p1.y) swap(p0, p1);
if (sig(p0.y) <= 0 && 0 < sig(p1.y) && sig(p0.det(p1)) > 0) side = -side;
}
return side;
}
Pt p[4];
Pt q[10];
int main(){
for(int i=0;i<3;i++){
double X,Y;
scanf("%lf%lf",&X,&Y);
p[i]=Pt(X,Y);
}
p[3]=p[0];
if(iSP(p[0],p[1],p[2])<0)swap(p[1],p[2]);
double left=0;
double right=11000;
for(int i=0;i<100;i++){
double M=(left+right)/2;
Pt v1=(p[1]-p[0])*Pt(0,1);
v1=v1/v1.ABS()*M;
pair<Pt,Pt> l1=make_pair(p[0]+v1,p[1]+v1);
Pt v2=(p[2]-p[1])*Pt(0,1);
v2=v2/v2.ABS()*M;
pair<Pt,Pt> l2=make_pair(p[1]+v2,p[2]+v2);
Pt v3=(p[0]-p[2])*Pt(0,1);
v3=v3/v3.ABS()*M;
pair<Pt,Pt> l3=make_pair(p[2]+v3,p[0]+v3);
q[0]=pLL(l1.first,l1.second,l2.first,l2.second);
q[1]=pLL(l2.first,l2.second,l3.first,l3.second);
q[2]=pLL(l3.first,l3.second,l1.first,l1.second);
bool ok=true;
if(sGP(3,p,q[0])==-1)ok=false;
if(sGP(3,p,q[1])==-1)ok=false;
if(sGP(3,p,q[2])==-1)ok=false;
if(dLS(p[0],p[1],q[0])<M-EPS)ok=false;
if(dLS(p[0],p[1],q[1])<M-EPS)ok=false;
if(dLS(p[0],p[1],q[2])<M-EPS)ok=false;
if(dLS(p[2],p[1],q[0])<M-EPS)ok=false;
if(dLS(p[2],p[1],q[1])<M-EPS)ok=false;
if(dLS(p[2],p[1],q[2])<M-EPS)ok=false;
if(dLS(p[0],p[2],q[0])<M-EPS)ok=false;
if(dLS(p[0],p[2],q[1])<M-EPS)ok=false;
if(dLS(p[0],p[2],q[2])<M-EPS)ok=false;
if(max(max((q[0]-q[1]).ABS(),(q[2]-q[1]).ABS()),(q[0]-q[2]).ABS())<M*2)ok=false;
if(ok)left=M;
else right=M;
}
printf("%.12f\n",left);
} | a.cc: In function 'int main()':
a.cc:131:23: error: too few arguments to function 'double dLS(Pt, Pt, Pt, Pt)'
131 | if(dLS(p[0],p[1],q[0])<M-EPS)ok=false;
| ~~~^~~~~~~~~~~~~~~~
a.cc:84:8: note: declared here
84 | double dLS(Pt a, Pt b, Pt c, Pt d) {
| ^~~
a.cc:132:23: error: too few arguments to function 'double dLS(Pt, Pt, Pt, Pt)'
132 | if(dLS(p[0],p[1],q[1])<M-EPS)ok=false;
| ~~~^~~~~~~~~~~~~~~~
a.cc:84:8: note: declared here
84 | double dLS(Pt a, Pt b, Pt c, Pt d) {
| ^~~
a.cc:133:23: error: too few arguments to function 'double dLS(Pt, Pt, Pt, Pt)'
133 | if(dLS(p[0],p[1],q[2])<M-EPS)ok=false;
| ~~~^~~~~~~~~~~~~~~~
a.cc:84:8: note: declared here
84 | double dLS(Pt a, Pt b, Pt c, Pt d) {
| ^~~
a.cc:134:23: error: too few arguments to function 'double dLS(Pt, Pt, Pt, Pt)'
134 | if(dLS(p[2],p[1],q[0])<M-EPS)ok=false;
| ~~~^~~~~~~~~~~~~~~~
a.cc:84:8: note: declared here
84 | double dLS(Pt a, Pt b, Pt c, Pt d) {
| ^~~
a.cc:135:23: error: too few arguments to function 'double dLS(Pt, Pt, Pt, Pt)'
135 | if(dLS(p[2],p[1],q[1])<M-EPS)ok=false;
| ~~~^~~~~~~~~~~~~~~~
a.cc:84:8: note: declared here
84 | double dLS(Pt a, Pt b, Pt c, Pt d) {
| ^~~
a.cc:136:23: error: too few arguments to function 'double dLS(Pt, Pt, Pt, Pt)'
136 | if(dLS(p[2],p[1],q[2])<M-EPS)ok=false;
| ~~~^~~~~~~~~~~~~~~~
a.cc:84:8: note: declared here
84 | double dLS(Pt a, Pt b, Pt c, Pt d) {
| ^~~
a.cc:137:23: error: too few arguments to function 'double dLS(Pt, Pt, Pt, Pt)'
137 | if(dLS(p[0],p[2],q[0])<M-EPS)ok=false;
| ~~~^~~~~~~~~~~~~~~~
a.cc:84:8: note: declared here
84 | double dLS(Pt a, Pt b, Pt c, Pt d) {
| ^~~
a.cc:138:23: error: too few arguments to function 'double dLS(Pt, Pt, Pt, Pt)'
138 | if(dLS(p[0],p[2],q[1])<M-EPS)ok=false;
| ~~~^~~~~~~~~~~~~~~~
a.cc:84:8: note: declared here
84 | double dLS(Pt a, Pt b, Pt c, Pt d) {
| ^~~
a.cc:139:23: error: too few arguments to function 'double dLS(Pt, Pt, Pt, Pt)'
139 | if(dLS(p[0],p[2],q[2])<M-EPS)ok=false;
| ~~~^~~~~~~~~~~~~~~~
a.cc:84:8: note: declared here
84 | double dLS(Pt a, Pt b, Pt c, Pt d) {
| ^~~
|
s389417120 | p03870 | C++ | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1e5 + 5, MAX_M = 40;
int n, x, ans, p;
int a[MAX_N];
int l[MAX_N];
bool cnt[MAX_M];
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++)
scanf("%d", &a[i]);
for (int i = 0; i < n; i++)
x ^= a[i];
for (int i = 0; i < n; i++) {
l[i] = __builtin_ctz(a[i]);
cnt[l[i]]++;
}
for (int i = 31; ~i; i--)
if (((x >> i) & 1) ^ p) {
if (!cnt[i]) {
printf("-1");
return 0;
}
p = !p;
cnt[i]--;
ans++;
}
printf("%d", ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:20:25: error: use of an operand of type 'bool' in 'operator++' is forbidden in C++17
20 | cnt[l[i]]++;
| ~~~~~~~~^
a.cc:32:30: error: use of an operand of type 'bool' in 'operator--' is forbidden
32 | cnt[i]--;
| ~~~~~^
|
s032355025 | p03870 | C++ | #include <bits/stdc++.h>
using namespace std;
const long long MAX_N = 1e5 + 5;
long long n, x, ans;
long long a[MAX_N];
long long l[MAX_N];
long long cnt[MAX_N];
long long main() {
ios::sync_with_stdio(false), cin.tie(0);
cin >> n;
for (long long i = 0; i < n; i++)
cin >> a[i];
for (long long i = 0; i < n; i++)
x ^= a[i];
for (long long i = 0; i < n; i++) {
l[i] = __builtin_ctz(a[i]);
cnt[l[i]]++;
}
for (long long i = 20; ~i; i--)
if ((x >> i) & 1) {
if (!cnt[i]) {
cout << "-1\n";
return 0;
}
cnt[i]--;
x = ~x;
ans++;
}
cout << ans << "\n";
return 0;
} | cc1plus: error: '::main' must return 'int'
|
s443864564 | p03870 | C++ | #include<bits/stdc++.h>
using namespace std;
const int maxN = 1e3 + 13;
int n, ans, x;
bool mark[maxN];
vector<int> vec;
int main () {
cin >> n;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
x ^= a;
a = __builtin_ctz(a);
mark[a] = 1;
}
while (x) {
vec.push_back(x % 2);
x /= 2;
}
int indx = vec.size() - 1;
int lst = 0;
while (vec.size()) {
int u = vec.back();
vec.pop_back();
if (u != lst) {
if (!mark[indx])
return cout << -1 << endl, 0;
else
ans++;
}
indx--;
lst = u;
}
cout << ans << endl;
}
#include<bits/stdc++.h>
using namespace std;
const int maxN = 1e3 + 13;
int n, ans, x;
bool mark[maxN];
vector<int> vec;
int main () {
cin >> n;
for (int i = 0; i < n; i++) {
int a;
cin >> a;
x ^= a;
a = __builtin_ctz(a);
mark[a] = 1;
}
while (x) {
vec.push_back(x % 2);
x /= 2;
}
int indx = vec.size() - 1;
int lst = 0;
while (vec.size()) {
int u = vec.back();
vec.pop_back();
if (u != lst) {
if (!mark[indx])
return cout << -1 << endl, 0;
else
ans++;
}
indx--;
lst = u;
}
cout << ans << endl;
}
| a.cc:41:11: error: redefinition of 'const int maxN'
41 | const int maxN = 1e3 + 13;
| ^~~~
a.cc:3:11: note: 'const int maxN' previously defined here
3 | const int maxN = 1e3 + 13;
| ^~~~
a.cc:42:5: error: redefinition of 'int n'
42 | int n, ans, x;
| ^
a.cc:4:5: note: 'int n' previously declared here
4 | int n, ans, x;
| ^
a.cc:42:8: error: redefinition of 'int ans'
42 | int n, ans, x;
| ^~~
a.cc:4:8: note: 'int ans' previously declared here
4 | int n, ans, x;
| ^~~
a.cc:42:13: error: redefinition of 'int x'
42 | int n, ans, x;
| ^
a.cc:4:13: note: 'int x' previously declared here
4 | int n, ans, x;
| ^
a.cc:43:6: error: redefinition of 'bool mark [1013]'
43 | bool mark[maxN];
| ^~~~
a.cc:5:6: note: 'bool mark [1013]' previously declared here
5 | bool mark[maxN];
| ^~~~
a.cc:44:13: error: redefinition of 'std::vector<int> vec'
44 | vector<int> vec;
| ^~~
a.cc:6:13: note: 'std::vector<int> vec' previously declared here
6 | vector<int> vec;
| ^~~
a.cc:45:5: error: redefinition of 'int main()'
45 | int main () {
| ^~~~
a.cc:7:5: note: 'int main()' previously defined here
7 | int main () {
| ^~~~
|
s499190677 | p03870 | C++ | #include <cstdio>
int check[30];
int main() {
for (int bit = 29; bit >= 0; bit--) {
check[bit] = 0;
}
int n;
scanf("%d", &n);
int xor_sum = 0;
int a;
for (int i = 0; i < n; i++) {
scanf("%d", &a);
xor_sum ^= a;
a = a ^ (a - 1);
switch (a) {
case 1073741823:
check[29] = 1;
break;
case 536870911:
check[28] = 1;
break;
case 268435455:
check[27] = 1;
break;
case 134217727:
check[26] = 1;
break;
case 67108863:
check[25] = 1;
break;
case 33554431:
check[24] = 1;
break;
case 16777215:
check[23] = 1;
break;
case 8388607:
check[22] = 1;
break;
case 4194303:
check[21] = 1;
break;
case 2097151:
check[20] = 1;
break;
case 1048575:
check[19] = 1;
break;
case 524287:
check[18] = 1;
break;
case 262143:
check[17] = 1;
break;
case 131071:
check[16] = 1;
break;
case 65535:
check[15] = 1;
break;
case 32767:
check[14] = 1;
break;
case 16383:
check[13] = 1;
break;
case 8191:
check[12] = 1;
break;
case 4095:
check[11] = 1;
break;
case 2047:
check[10] = 1;
break;
case 1023:
check[9] = 1;
break;
case 511:
check[8] = 1;
break;
case 255:
check[7] = 1;
break;
case 127:
check[6] = 1;
break;
case 63:
check[5] = 1;
break;
case 31:
check[4] = 1;
break;
case 15:
check[3] = 1;
break;
case 7:
check[2] = 1;
break;
case 3:
check[1] = 1;
break;
case 1:
check[0] = 1;
break;
}
}
return;
int ans = 0;
for (int bit = 29; bit >= 0; bit--) {
if (((1 << bit) & xor_sum) == 0) {
continue;
}
int x = (1 << (bit + 1)) - 1;
if (check[bit] > 0) {
xor_sum ^= x;
ans += 1;
}
}
if (xor_sum != 0) {
printf("-1\n");
} else {
printf("%d\n", ans);
}
} | a.cc: In function 'int main()':
a.cc:113:3: error: return-statement with no value, in function returning 'int' [-fpermissive]
113 | return;
| ^~~~~~
|
s211083595 | p03870 | C | #include <cstdio>
#include <unordered_set>
int a[100000];
int main() {
int n;
scanf("%d", &n);
int xor_sum = 0;
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
xor_sum ^= a[i];
}
std::unordered_set<int> s;
for (int i = 0; i < n; i++)
s.insert(a[i] ^ (a[i] - 1));
int ans = 0;
for (int bit = 29; bit >= 0; bit--) {
if (((1 << bit) & xor_sum) == 0) {
continue;
}
int x = (1 << (bit + 1)) - 1;
if (s.find(x) != s.end()) {
xor_sum ^= x;
ans += 1;
}
}
if (xor_sum != 0) {
printf("-1\n");
} else {
printf("%d\n", ans);
}
} | main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s323604089 | p03870 | C++ | int check[30];
int main() {
int n;
scanf("%d", &n);
for (int i = 0; i < 30; i++)
check[i] = 0;
int xor_sum = 0;
for (int i = 0; i < n; i++) {
int x;
scanf("%d", &x);
switch (x) {
case 1:
check[0] = 1;
break;
case 3:
check[1] = 1;
break;
case 7:
check[2] = 1;
break;
case 15:
check[3] = 1;
break;
case 31:
check[4] = 1;
break;
case 63:
check[5] = 1;
break;
case 127:
check[6] = 1;
break;
case 255:
check[7] = 1;
break;
case 511:
check[8] = 1;
break;
case 1023:
check[9] = 1;
break;
case 2047:
check[10] = 1;
break;
case 4095:
check[11] = 1;
break;
case 8191:
check[12] = 1;
break;
case 16383:
check[13] = 1;
break;
case 32767:
check[14] = 1;
break;
case 65535:
check[15] = 1;
break;
case 131071:
check[16] = 1;
break;
case 262143:
check[17] = 1;
break;
case 524287:
check[18] = 1;
break;
case 1048575:
check[19] = 1;
break;
case 2097151:
check[20] = 1;
break;
case 4194303:
check[21] = 1;
break;
case 8388607:
check[22] = 1;
break;
case 16777215:
check[23] = 1;
break;
case 33554431:
check[24] = 1;
break;
case 67108863:
check[25] = 1;
break;
case 134217727:
check[26] = 1;
break;
case 268435455:
check[27] = 1;
break;
case 536870911:
check[28] = 1;
break;
case 1073741823:
check[29] = 1;
break;
default:
break;
}
xor_sum ^= x;
}
int ans = 0;
for (int bit = 29; bit >= 0; bit--) {
if (((1 << bit) & xor_sum) == 0) {
continue;
}
int x = (1 << (bit + 1)) - 1;
if (check[bit]) {
xor_sum ^= x;
ans += 1;
}
}
if (xor_sum != 0) {
printf("-1\n");
} else {
printf("%d\n", ans);
}
} | a.cc: In function 'int main()':
a.cc:4:3: error: 'scanf' was not declared in this scope
4 | scanf("%d", &n);
| ^~~~~
a.cc:124:5: error: 'printf' was not declared in this scope
124 | printf("-1\n");
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | int check[30];
a.cc:126:5: error: 'printf' was not declared in this scope
126 | printf("%d\n", ans);
| ^~~~~~
a.cc:126:5: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
|
s465647899 | p03871 | C++ | #include <bits/stdc++.h>
using namespace std;
int main() {
vector<double> p(6);
vector<double> q(6);
for(int i=0;i<6;i++){
cin>>p.at(i);
}
for(int i=0;i<6;i++){
cin>>q.at(i);
}
double ans=0;
double ANS=0;
for(iny64_t X=0;X<1000000;X++){
double x=X/1000000;
ans+=max(x*p.at(0)/100,(1-x)*q.at(0)/100);
ans+=max(x*p.at(1)/100,(1-x)*q.at(1)/100);
ans+=max(x*p.at(2)/100,(1-x)*q.at(2)/100);
ans+=max(x*p.at(3)/100,(1-x)*q.at(3)/100);
ans+=max(x*p.at(4)/100,(1-x)*q.at(4)/100);
ans+=max(x*p.at(5)/100,(1-x)*q.at(5)/100);
if(x=0){
ANS=ans;
}
ANS=min(ANS,ans);
ans=0;
}
cout << fixed << setprecision(20);
cout<<ANS<<endl;
}
| a.cc: In function 'int main()':
a.cc:15:7: error: 'iny64_t' was not declared in this scope; did you mean 'int64_t'?
15 | for(iny64_t X=0;X<1000000;X++){
| ^~~~~~~
| int64_t
a.cc:15:19: error: 'X' was not declared in this scope
15 | for(iny64_t X=0;X<1000000;X++){
| ^
|
s578232256 | p03871 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
long double p[10], q[10], sum, r, s; vector<pair<long double, long double>> A, B;
int main() {
for (int i = 1; i <= 6; i++) { cin >> p[i]; p[i] /= 100; }
for (int i = 1; i <= 6; i++) { cin >> q[i]; q[i] /= 100; }
for (int i = 1; i <= 6; i++) {
if (fabs(p[i] - q[i]) < 0.001) {
A.push_back(make_pair(0, p[i] + q[i]));
s += q[i];
}
else if (p[i] > q[i]) {
A.push_back(make_pair(p[i] - q[i], p[i] + q[i]));
s += q[i];
}
else {
B.push_back(make_pair(q[i] - p[i], p[i] + q[i]));
r += p[i];
}
}
sum = r + s; sort(A.begin(), A.end()); sort(B.begin(), B.end());
if (r < s) {
long double S = s - r;
for (int i = 0; i < A.size(); i++) {
long double E = A[i].second;
if (E > S) { sum += A[i].first*S / E; break; }
else { S -= A[i].second; sum += A[i].first; }
}
}
else {
long double S = r - s;
for (int i = 0; i < B.size(); i++) {
long double E = B[i].second;
if (E > S) { sum += B[i].first*S / E; break; }
else { S -= B[i].second; sum += B[i].first; }
}
}
printf("%.20Lf\n", 1.0L - sum / 2);
return 0;
} | a.cc: In function 'int main()':
a.cc:12:21: error: 'fabs' was not declared in this scope; did you mean 'labs'?
12 | if (fabs(p[i] - q[i]) < 0.001) {
| ^~~~
| labs
|
s933647928 | p03871 | C++ | #include <iostream>
#include <algorithm>
using namespace std;
long double p[100], q[100]; int bit[6];
pair<long double, long double> tourist(int v) {
if (bit[v - 1] == 0) {
if (fabs(p[v] - q[v]) < 0.000001)return make_pair(0.5, 0.5);
if (p[v] > q[v])return make_pair(1, 0);
return make_pair(0, 1);
}
return make_pair(p[v] / (p[v] + q[v]), q[v] / (p[v] + q[v]));
}
long double solve(long double P) {
long double sum = 0;
for (int i = 1; i <= 6; i++) {
pair<long double, long double> A = tourist(i);
sum += A.first*P*p[i];
sum += A.second*(1.0L - P)*q[i];
}
return sum;
}
long double solve() {
long double L = 0, R = 1, c1, c2, maxn = 1;
for (int i = 0; i < 100; i++) {
c1 = (L + L + R) / 3;
c2 = (L + R + R) / 3;
long double d1 = solve(c1), d2 = solve(c2);
if (d1 < d2) { maxn = d1; R = c2; }
else { maxn = d2; L = c1; }
}
return maxn;
}
int main() {
for (int i = 1; i <= 6; i++) { cin >> p[i]; p[i] /= 100; }
for (int i = 1; i <= 6; i++) { cin >> q[i]; q[i] /= 100; }
long double ans = 0;
for (int i = 0; i < 64; i++) {
for (int j = 0; j < 6; j++)bit[j] = (i / (1 << j)) % 2;
ans = max(ans, solve());
}
printf("%.20Lf\n", ans);
return 0;
} | a.cc: In function 'std::pair<long double, long double> tourist(int)':
a.cc:9:21: error: 'fabs' was not declared in this scope; did you mean 'labs'?
9 | if (fabs(p[v] - q[v]) < 0.000001)return make_pair(0.5, 0.5);
| ^~~~
| labs
|
s669708352 | p03871 | C++ | #include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef long double lf;
ll cross(pii a, pii b) {
return 1LL * a.first * b.second - 1LL * a.second * b.first;
}
int P[6], Q[6];
vector<pii> Sum, Conv;
vector<pii> mrg(vector<pii> &a, vector<pii> &b) {
vector<pii> ret;
int pos1 = 0, pos2 = 0;
while(pos1 < a.size() && pos2 < b.size()) {
if(cross(a[pos1], b[pos2]) <= 0) ret.push_back(a[pos1]), pos1++;
else ret.push_back(b[pos2]), pos2++;
}
while(pos1 < a.size()) ret.push_back(a[pos1]), pos1++;
while(pos2 < b.size()) ret.push_back(b[pos2]), pos2++;
return ret;
}
int main() {
for(int i = 0; i < 6; i++) {
scanf("%d", &P[i]);
}
for(int i = 0; i < 6; i++) {
scanf("%d", &Q[i]);
}
Sum.push_back(pii(-P[0], Q[0]));
Sum.push_back(pii(P[0], -Q[0]));
for(int i = 1; i < 6; i++) {
vector<pii> tmp;
tmp.push_back(pii(-P[i], Q[i]));
tmp.push_back(pii(P[i], -Q[i]));
Sum = mrg(Sum, tmp);
}
pii st = pii(0, 0);
for(int i = 0; i < 6; i++) {
st.first += P[i];
}
Conv.push_back(st);
for(int i = 0; i < (int)Sum.size() - 1; i++) {
pii tmp = Conv.back();
Conv.push_back(pii(tmp.first + Sum[i].first, tmp.second + Sum[i].second));
}
lf ans = 0;
for(int i = 0; i < Conv.size(); i++) {
pii a = Conv[i];
pii b = Conv[(i + 1)%Conv.size()];
if(a.first == a.second || b.first == b.second || ((a.first < a.second) ^ (b.first < b.second))) {
lf x1 = a.first;
lf y1 = a.second;
lf x2 = b.first;
lf y2 = b.second;
if(a.first == b.first) ans = max(ans, x1);
else ans = max(ans, (y1 - (y2 - y1) / (x2 - x1) * x1) / (1 - (y2 - y1) / (x2 - x1)));
}
else if(a.first < a.second) ans = max(ans, max(a.first, b.first));
else ans = max(ans, max(a.second, b.second));
}
cout<<fixed;
cout.precision(20);
cout << ans / 100;
}
| a.cc: In function 'int main()':
a.cc:73:46: error: no matching function for call to 'max(lf&, const int&)'
73 | else if(a.first < a.second) ans = max(ans, max(a.first, b.first));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:73:46: note: deduced conflicting types for parameter 'const _Tp' ('long double' and 'int')
73 | else if(a.first < a.second) ans = max(ans, max(a.first, b.first));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:73:46: note: mismatched types 'std::initializer_list<_Tp>' and 'long double'
73 | else if(a.first < a.second) ans = max(ans, max(a.first, b.first));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:74:23: error: no matching function for call to 'max(lf&, const int&)'
74 | else ans = max(ans, max(a.second, b.second));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: template argument deduction/substitution failed:
a.cc:74:23: note: deduced conflicting types for parameter 'const _Tp' ('long double' and 'int')
74 | else ans = max(ans, max(a.second, b.second));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
5706 | max(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
5716 | max(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: template argument deduction/substitution failed:
a.cc:74:23: note: mismatched types 'std::initializer_list<_Tp>' and 'long double'
74 | else ans = max(ans, max(a.second, b.second));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s310545058 | p03871 | C++ | asm(" .file \"ttt.cpp\"");
asm("#APP");
asm(" .file \"ttt.cpp\"");
asm(" #APP");
asm(" .file \"ttt.cpp\"");
asm(" #APP");
asm(" .file \"ttt.cpp\"");
asm(" .section .text.unlikely,\"ax\",@progbits");
asm(" .LCOLDB4:");
asm(" .text");
asm(" .LHOTB4:");
asm(" .p2align 4,,15");
asm(" .globl _Z4calce");
asm(" .type _Z4calce, @function");
asm(" _Z4calce:");
asm(" .LFB3714:");
asm(" .cfi_startproc");
asm(" fldt 4(%esp)");
asm(" fld %st(0)");
asm(" fsubrs .LC0");
asm(" fldt in");
asm(" fldt in+72");
asm(" fld %st(0)");
asm(" fmul %st(3), %st");
asm(" fld %st(4)");
asm(" fmul %st(3), %st");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L2");
asm(" fstp %st(1)");
asm(" fdivs .LC1");
asm(" fmul %st(1), %st");
asm(" fadds .LC2");
asm(" .L3:");
asm(" fldt in+12");
asm(" fldt in+84");
asm(" fld %st(4)");
asm(" fmul %st(2), %st");
asm(" fld %st(4)");
asm(" fmul %st(2), %st");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L4");
asm(" fstp %st(1)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L5:");
asm(" fldt in+24");
asm(" fldt in+96");
asm(" fld %st(4)");
asm(" fmul %st(2), %st");
asm(" fld %st(4)");
asm(" fmul %st(2), %st");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L6");
asm(" fstp %st(1)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L7:");
asm(" fldt in+36");
asm(" fldt in+108");
asm(" fld %st(4)");
asm(" fmul %st(2), %st");
asm(" fld %st(4)");
asm(" fmul %st(2), %st");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L8");
asm(" fstp %st(1)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L9:");
asm(" fldt in+48");
asm(" fldt in+120");
asm(" fld %st(4)");
asm(" fmul %st(2), %st");
asm(" fld %st(4)");
asm(" fmul %st(2), %st");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L10");
asm(" fstp %st(1)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L11:");
asm(" fldt in+60");
asm(" fldt in+132");
asm(" fld %st(1)");
asm(" fmul %st(5), %st");
asm(" fld %st(1)");
asm(" fmul %st(5), %st");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" jbe .L16");
asm(" fstp %st(0)");
asm(" fstp %st(2)");
asm(" fxch %st(1)");
asm(" fdivs .LC1");
asm(" fmulp %st, %st(2)");
asm(" faddp %st, %st(1)");
asm(" fsubrs .LC0");
asm(" ret");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L2:");
asm(" fstp %st(0)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" fadds .LC2");
asm(" jmp .L3");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L16:");
asm(" fstp %st(4)");
asm(" fstp %st(0)");
asm(" fxch %st(1)");
asm(" fxch %st(2)");
asm(" fdivs .LC1");
asm(" fmulp %st, %st(2)");
asm(" faddp %st, %st(1)");
asm(" fsubrs .LC0");
asm(" ret");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L10:");
asm(" fstp %st(0)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L11");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L8:");
asm(" fstp %st(0)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L9");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L6:");
asm(" fstp %st(0)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L7");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L4:");
asm(" fstp %st(0)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L5");
asm(" .cfi_endproc");
asm(" .LFE3714:");
asm(" .size _Z4calce, .-_Z4calce");
asm(" .section .text.unlikely");
asm(" .LCOLDE4:");
asm(" .text");
asm(" .LHOTE4:");
asm(" .section .rodata.str1.1,\"aMS\",@progbits,1");
asm(" .LC5:");
asm(" .string \"%Lf\"");
asm(" .LC7:");
asm(" .string \"%.10Lf");
asm(" \"");
asm(" .section .text.unlikely");
asm(" .LCOLDB9:");
asm(" .section .text.startup,\"ax\",@progbits");
asm(" .LHOTB9:");
asm(" .p2align 4,,15");
asm(" .globl main");
asm(" .type main, @function");
asm(" main:");
asm(" .LFB3715:");
asm(" .cfi_startproc");
asm(" leal 4(%esp), %ecx");
asm(" .cfi_def_cfa 1, 0");
asm(" andl $-16, %esp");
asm(" pushl -4(%ecx)");
asm(" pushl %ebp");
asm(" .cfi_escape 0x10,0x5,0x2,0x75,0");
asm(" movl %esp, %ebp");
asm(" pushl %esi");
asm(" pushl %ebx");
asm(" pushl %ecx");
asm(" .cfi_escape 0xf,0x3,0x75,0x74,0x6");
asm(" .cfi_escape 0x10,0x6,0x2,0x75,0x7c");
asm(" .cfi_escape 0x10,0x3,0x2,0x75,0x78");
asm(" movl $in, %esi");
asm(" movl $in+72, %ebx");
asm(" subl $428, %esp");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L19:");
asm(" subl $8, %esp");
asm(" pushl %esi");
asm(" pushl $.LC5");
asm(" addl $12, %esi");
asm(" call scanf");
asm(" addl $16, %esp");
asm(" cmpl %esi, %ebx");
asm(" jne .L19");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L20:");
asm(" subl $8, %esp");
asm(" pushl %ebx");
asm(" pushl $.LC5");
asm(" addl $12, %ebx");
asm(" call scanf");
asm(" addl $16, %esp");
asm(" cmpl $in+144, %ebx");
asm(" jne .L20");
asm(" fldt in");
asm(" movl $1000, %eax");
asm(" fstpt -152(%ebp)");
asm(" fldt in+72");
asm(" fstpt -248(%ebp)");
asm(" fldt in+12");
asm(" fstpt -104(%ebp)");
asm(" fldt in+84");
asm(" fstpt -232(%ebp)");
asm(" fldt in+24");
asm(" fstpt -136(%ebp)");
asm(" fldt in+96");
asm(" fstpt -184(%ebp)");
asm(" fldt in+36");
asm(" fstpt -120(%ebp)");
asm(" fldt in+108");
asm(" fstpt -216(%ebp)");
asm(" fldt in+48");
asm(" fstpt -72(%ebp)");
asm(" fldt in+120");
asm(" fstpt -168(%ebp)");
asm(" fldt in+60");
asm(" fstpt -88(%ebp)");
asm(" fldt in+132");
asm(" fstpt -200(%ebp)");
asm(" fld1");
asm(" fstpt -56(%ebp)");
asm(" fldz");
asm(" fstpt -40(%ebp)");
asm(" jmp .L47");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L85:");
asm(" fxch %st(1)");
asm(" fdivs .LC1");
asm(" fmul %st(1), %st");
asm(" fadds .LC2");
asm(" .L22:");
asm(" fldt -104(%ebp)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -296(%ebp)");
asm(" fldt -232(%ebp)");
asm(" fld %st(0)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -312(%ebp)");
asm(" fxch %st(2)");
asm(" fucomip %st(2), %st");
asm(" fstp %st(1)");
asm(" ja .L23");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L24:");
asm(" fldt -136(%ebp)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -328(%ebp)");
asm(" fldt -184(%ebp)");
asm(" fld %st(0)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -344(%ebp)");
asm(" fxch %st(2)");
asm(" fucomip %st(2), %st");
asm(" fstp %st(1)");
asm(" ja .L25");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L26:");
asm(" fldt -120(%ebp)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -360(%ebp)");
asm(" fldt -216(%ebp)");
asm(" fld %st(0)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -376(%ebp)");
asm(" fxch %st(2)");
asm(" fucomip %st(2), %st");
asm(" fstp %st(1)");
asm(" ja .L27");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L28:");
asm(" fldt -72(%ebp)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -392(%ebp)");
asm(" fldt -168(%ebp)");
asm(" fld %st(0)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -408(%ebp)");
asm(" fxch %st(2)");
asm(" fucomip %st(2), %st");
asm(" fstp %st(1)");
asm(" ja .L29");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L30:");
asm(" fldt -88(%ebp)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -424(%ebp)");
asm(" fldt -200(%ebp)");
asm(" fld %st(0)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -440(%ebp)");
asm(" fxch %st(2)");
asm(" fucomip %st(2), %st");
asm(" fstp %st(1)");
asm(" ja .L31");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L32:");
asm(" fld1");
asm(" fsub %st, %st(1)");
asm(" fsub %st(3), %st");
asm(" fldt -248(%ebp)");
asm(" fld %st(0)");
asm(" fmul %st(2), %st");
asm(" fldt -152(%ebp)");
asm(" fmul %st(6), %st");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L33");
asm(" fdivs .LC1");
asm(" fmul %st(1), %st");
asm(" fadds .LC2");
asm(" .L34:");
asm(" fldt -232(%ebp)");
asm(" fmul %st(2), %st");
asm(" fldt -104(%ebp)");
asm(" fmul %st(6), %st");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L35");
asm(" fldt -232(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L36:");
asm(" fldt -184(%ebp)");
asm(" fmul %st(2), %st");
asm(" fldt -136(%ebp)");
asm(" fmul %st(6), %st");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L37");
asm(" fldt -184(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L38:");
asm(" fldt -216(%ebp)");
asm(" fmul %st(2), %st");
asm(" fldt -120(%ebp)");
asm(" fmul %st(6), %st");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L39");
asm(" fldt -216(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L40:");
asm(" fldt -168(%ebp)");
asm(" fmul %st(2), %st");
asm(" fldt -72(%ebp)");
asm(" fmul %st(6), %st");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L41");
asm(" fldt -168(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L42:");
asm(" fldt -200(%ebp)");
asm(" fmul %st(2), %st");
asm(" fldt -88(%ebp)");
asm(" fmul %st(6), %st");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L43");
asm(" fldt -200(%ebp)");
asm(" fdivs .LC1");
asm(" fmulp %st, %st(2)");
asm(" faddp %st, %st(1)");
asm(" .L44:");
asm(" fsubrs .LC0");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" fldt -56(%ebp)");
asm(" fcmovbe %st(2), %st");
asm(" fstp %st(2)");
asm(" fxch %st(1)");
asm(" fstpt -56(%ebp)");
asm(" fldt -40(%ebp)");
asm(" fcmovnbe %st(2), %st");
asm(" subl $1, %eax");
asm(" fstpt -40(%ebp)");
asm(" je .L84");
asm(" fstp %st(0)");
asm(" fstp %st(0)");
asm(" .L47:");
asm(" fldt -56(%ebp)");
asm(" fldt -40(%ebp)");
asm(" fsubr %st, %st(1)");
asm(" fldt .LC8");
asm(" fdivr %st(2), %st");
asm(" fadd %st(1), %st");
asm(" fxch %st(2)");
asm(" fadd %st(0), %st");
asm(" fldt .LC8");
asm(" fdivrp %st, %st(1)");
asm(" faddp %st, %st(1)");
asm(" fldt -152(%ebp)");
asm(" fmul %st(2), %st");
asm(" fld %st(0)");
asm(" fstpt -264(%ebp)");
asm(" fld %st(2)");
asm(" fsubrs .LC0");
asm(" fldt -248(%ebp)");
asm(" fld %st(0)");
asm(" fmul %st(2), %st");
asm(" fld %st(0)");
asm(" fstpt -280(%ebp)");
asm(" fxch %st(3)");
asm(" fucomip %st(3), %st");
asm(" fstp %st(2)");
asm(" jbe .L85");
asm(" fstp %st(1)");
asm(" fldt -152(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" fadds .LC2");
asm(" jmp .L22");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L43:");
asm(" fstp %st(1)");
asm(" fldt -88(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(4), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L44");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L41:");
asm(" fldt -72(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(5), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L42");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L39:");
asm(" fldt -120(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(5), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L40");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L37:");
asm(" fldt -136(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(5), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L38");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L35:");
asm(" fldt -104(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(5), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L36");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L33:");
asm(" fstp %st(0)");
asm(" fldt -152(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(4), %st");
asm(" fadds .LC2");
asm(" jmp .L34");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L31:");
asm(" fstp %st(0)");
asm(" fldt -88(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(4), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L32");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L29:");
asm(" fstp %st(0)");
asm(" fldt -72(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(4), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L30");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L27:");
asm(" fstp %st(0)");
asm(" fldt -120(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(4), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L28");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L25:");
asm(" fstp %st(0)");
asm(" fldt -136(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(4), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L26");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L23:");
asm(" fstp %st(0)");
asm(" fldt -104(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(4), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L24");
asm(" .L84:");
asm(" fldt -264(%ebp)");
asm(" fldt -280(%ebp)");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" jbe .L77");
asm(" fldt -152(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" fadds .LC2");
asm(" .L50:");
asm(" fldt -296(%ebp)");
asm(" fldt -312(%ebp)");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" jbe .L78");
asm(" fldt -104(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" faddp %st, %st(1)");
asm(" .L53:");
asm(" fldt -328(%ebp)");
asm(" fldt -344(%ebp)");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" jbe .L79");
asm(" fldt -136(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" faddp %st, %st(1)");
asm(" .L56:");
asm(" fldt -360(%ebp)");
asm(" fldt -376(%ebp)");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" jbe .L80");
asm(" fldt -120(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" faddp %st, %st(1)");
asm(" .L59:");
asm(" fldt -392(%ebp)");
asm(" fldt -408(%ebp)");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" jbe .L81");
asm(" fldt -72(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" faddp %st, %st(1)");
asm(" .L62:");
asm(" fldt -424(%ebp)");
asm(" fldt -440(%ebp)");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" jbe .L82");
asm(" fstp %st(1)");
asm(" fldt -88(%ebp)");
asm(" fdivs .LC1");
asm(" fmulp %st, %st(2)");
asm(" faddp %st, %st(1)");
asm(" .L65:");
asm(" fld1");
asm(" subl $24, %esp");
asm(" fsub %st, %st(1)");
asm(" fsubp %st, %st(1)");
asm(" fstpt (%esp)");
asm(" pushl $.LC7");
asm(" pushl $1");
asm(" call __printf_chk");
asm(" addl $32, %esp");
asm(" leal -12(%ebp), %esp");
asm(" xorl %eax, %eax");
asm(" popl %ecx");
asm(" .cfi_remember_state");
asm(" .cfi_restore 1");
asm(" .cfi_def_cfa 1, 0");
asm(" popl %ebx");
asm(" .cfi_restore 3");
asm(" popl %esi");
asm(" .cfi_restore 6");
asm(" popl %ebp");
asm(" .cfi_restore 5");
asm(" leal -4(%ecx), %esp");
asm(" .cfi_def_cfa 4, 4");
asm(" ret");
asm(" .L77:");
asm(" .cfi_restore_state");
asm(" fldt -248(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(1), %st");
asm(" fadds .LC2");
asm(" jmp .L50");
asm(" .L82:");
asm(" fstp %st(2)");
asm(" fxch %st(1)");
asm(" fldt -200(%ebp)");
asm(" fdivs .LC1");
asm(" fmulp %st, %st(2)");
asm(" faddp %st, %st(1)");
asm(" jmp .L65");
asm(" .L81:");
asm(" fldt -168(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L62");
asm(" .L80:");
asm(" fldt -216(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L59");
asm(" .L79:");
asm(" fldt -184(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L56");
asm(" .L78:");
asm(" fldt -232(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L53");
asm(" .cfi_endproc");
asm(" .LFE3715:");
asm(" .size main, .-main");
asm(" .section .text.unlikely");
asm(" .LCOLDE9:");
asm(" .section .text.startup");
asm(" .LHOTE9:");
asm(" .section .text.unlikely");
asm(" .LCOLDB10:");
asm(" .section .text.startup");
asm(" .LHOTB10:");
asm(" .p2align 4,,15");
asm(" .type _GLOBAL__sub_I_in, @function");
asm(" _GLOBAL__sub_I_in:");
asm(" .LFB3734:");
asm(" .cfi_startproc");
asm(" subl $24, %esp");
asm(" .cfi_def_cfa_offset 28");
asm(" pushl $_ZStL8__ioinit");
asm(" .cfi_def_cfa_offset 32");
asm(" call _ZNSt8ios_base4InitC1Ev");
asm(" addl $12, %esp");
asm(" .cfi_def_cfa_offset 20");
asm(" pushl $__dso_handle");
asm(" .cfi_def_cfa_offset 24");
asm(" pushl $_ZStL8__ioinit");
asm(" .cfi_def_cfa_offset 28");
asm(" pushl $_ZNSt8ios_base4InitD1Ev");
asm(" .cfi_def_cfa_offset 32");
asm(" call __cxa_atexit");
asm(" addl $28, %esp");
asm(" .cfi_def_cfa_offset 4");
asm(" ret");
asm(" .cfi_endproc");
asm(" .LFE3734:");
asm(" .size _GLOBAL__sub_I_in, .-_GLOBAL__sub_I_in");
asm(" .section .text.unlikely");
asm(" .LCOLDE10:");
asm(" .section .text.startup");
asm(" .LHOTE10:");
asm(" .section .init_array,\"aw\"");
asm(" .align 4");
asm(" .long _GLOBAL__sub_I_in");
asm(" .globl in");
asm(" .bss");
asm(" .align 32");
asm(" .type in, @object");
asm(" .size in, 144");
asm(" in:");
asm(" .zero 144");
asm(" .local _ZStL8__ioinit");
asm(" .comm _ZStL8__ioinit,1,1");
asm(" .section .rodata.cst4,\"aM\",@progbits,4");
asm(" .align 4");
asm(" .LC0:");
asm(" .long 1065353216");
asm(" .align 4");
asm(" .LC1:");
asm(" .long 1120403456");
asm(" .align 4");
asm(" .LC2:");
asm(" .long 0");
asm(" .section .rodata.cst16,\"aM\",@progbits,16");
asm(" .align 16");
asm(" .LC8:");
asm(" .long 0");
asm(" .long 3221225472");
asm(" .long 16384");
asm(" .align 16");
asm(" .hidden __dso_handle");
asm(" .ident \"GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609\"");
asm(" .section .note.GNU-stack,\"\",@progbits");
asm(" .ident \"GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609\"");
asm(" .section .note.GNU-stack,\"\",@progbits");
asm(" .ident \"GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609\"");
asm(" .section .note.GNU-stack,\"\",@progbits");
asm(" .ident \"GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609\"");
asm(" .section .note.GNU-stack,\"\",@progbits"); | /tmp/ccN6fwU0.s: Assembler messages:
/tmp/ccN6fwU0.s:179: Warning: unterminated string; newline inserted
/tmp/ccN6fwU0.s:194: Error: invalid instruction suffix for `push'
/tmp/ccN6fwU0.s:195: Error: invalid instruction suffix for `push'
/tmp/ccN6fwU0.s:198: Error: invalid instruction suffix for `push'
/tmp/ccN6fwU0.s:199: Error: invalid instruction suffix for `push'
/tmp/ccN6fwU0.s:200: Error: invalid instruction suffix for `push'
/tmp/ccN6fwU0.s:211: Error: invalid instruction suffix for `push'
/tmp/ccN6fwU0.s:212: Error: invalid instruction suffix for `push'
/tmp/ccN6fwU0.s:222: Error: invalid instruction suffix for `push'
/tmp/ccN6fwU0.s:223: Error: invalid instruction suffix for `push'
/tmp/ccN6fwU0.s:643: Error: invalid instruction suffix for `push'
/tmp/ccN6fwU0.s:644: Error: invalid instruction suffix for `push'
/tmp/ccN6fwU0.s:649: Error: invalid instruction suffix for `pop'
/tmp/ccN6fwU0.s:653: Error: invalid instruction suffix for `pop'
/tmp/ccN6fwU0.s:655: Error: invalid instruction suffix for `pop'
/tmp/ccN6fwU0.s:657: Error: invalid instruction suffix for `pop'
/tmp/ccN6fwU0.s:719: Error: invalid instruction suffix for `push'
/tmp/ccN6fwU0.s:724: Error: invalid instruction suffix for `push'
/tmp/ccN6fwU0.s:726: Error: invalid instruction suffix for `push'
/tmp/ccN6fwU0.s:728: Error: invalid instruction suffix for `push'
|
s771943577 | p03871 | C++ | asm(" .file \"ttt.cpp\"");
asm("#APP");
asm(" .file \"ttt.cpp\"");
asm(" #APP");
asm(" .file \"ttt.cpp\"");
asm(" .section .text.unlikely,\"ax\",@progbits");
asm(" .LCOLDB4:");
asm(" .text");
asm(" .LHOTB4:");
asm(" .p2align 4,,15");
asm(" .globl _Z4calce");
asm(" .type _Z4calce, @function");
asm(" _Z4calce:");
asm(" .LFB3714:");
asm(" .cfi_startproc");
asm(" fldt 4(%esp)");
asm(" fld %st(0)");
asm(" fsubrs .LC0");
asm(" fldt in");
asm(" fldt in+72");
asm(" fld %st(0)");
asm(" fmul %st(3), %st");
asm(" fld %st(4)");
asm(" fmul %st(3), %st");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L2");
asm(" fstp %st(1)");
asm(" fdivs .LC1");
asm(" fmul %st(1), %st");
asm(" fadds .LC2");
asm(" .L3:");
asm(" fldt in+12");
asm(" fldt in+84");
asm(" fld %st(4)");
asm(" fmul %st(2), %st");
asm(" fld %st(4)");
asm(" fmul %st(2), %st");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L4");
asm(" fstp %st(1)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L5:");
asm(" fldt in+24");
asm(" fldt in+96");
asm(" fld %st(4)");
asm(" fmul %st(2), %st");
asm(" fld %st(4)");
asm(" fmul %st(2), %st");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L6");
asm(" fstp %st(1)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L7:");
asm(" fldt in+36");
asm(" fldt in+108");
asm(" fld %st(4)");
asm(" fmul %st(2), %st");
asm(" fld %st(4)");
asm(" fmul %st(2), %st");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L8");
asm(" fstp %st(1)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L9:");
asm(" fldt in+48");
asm(" fldt in+120");
asm(" fld %st(4)");
asm(" fmul %st(2), %st");
asm(" fld %st(4)");
asm(" fmul %st(2), %st");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L10");
asm(" fstp %st(1)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L11:");
asm(" fldt in+60");
asm(" fldt in+132");
asm(" fld %st(1)");
asm(" fmul %st(5), %st");
asm(" fld %st(1)");
asm(" fmul %st(5), %st");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" jbe .L16");
asm(" fstp %st(0)");
asm(" fstp %st(2)");
asm(" fxch %st(1)");
asm(" fdivs .LC1");
asm(" fmulp %st, %st(2)");
asm(" faddp %st, %st(1)");
asm(" fsubrs .LC0");
asm(" ret");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L2:");
asm(" fstp %st(0)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" fadds .LC2");
asm(" jmp .L3");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L16:");
asm(" fstp %st(4)");
asm(" fstp %st(0)");
asm(" fxch %st(1)");
asm(" fxch %st(2)");
asm(" fdivs .LC1");
asm(" fmulp %st, %st(2)");
asm(" faddp %st, %st(1)");
asm(" fsubrs .LC0");
asm(" ret");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L10:");
asm(" fstp %st(0)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L11");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L8:");
asm(" fstp %st(0)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L9");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L6:");
asm(" fstp %st(0)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L7");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L4:");
asm(" fstp %st(0)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L5");
asm(" .cfi_endproc");
asm(" .LFE3714:");
asm(" .size _Z4calce, .-_Z4calce");
asm(" .section .text.unlikely");
asm(" .LCOLDE4:");
asm(" .text");
asm(" .LHOTE4:");
asm(" .section .rodata.str1.1,\"aMS\",@progbits,1");
asm(" .LC5:");
asm(" .string \"%Lf\"");
asm(" .LC7:");
asm(" .string \"%.10Lf");
asm(" \"");
asm(" .section .text.unlikely");
asm(" .LCOLDB9:");
asm(" .section .text.startup,\"ax\",@progbits");
asm(" .LHOTB9:");
asm(" .p2align 4,,15");
asm(" .globl main");
asm(" .type main, @function");
asm(" main:");
asm(" .LFB3715:");
asm(" .cfi_startproc");
asm(" leal 4(%esp), %ecx");
asm(" .cfi_def_cfa 1, 0");
asm(" andl $-16, %esp");
asm(" pushl -4(%ecx)");
asm(" pushl %ebp");
asm(" .cfi_escape 0x10,0x5,0x2,0x75,0");
asm(" movl %esp, %ebp");
asm(" pushl %esi");
asm(" pushl %ebx");
asm(" pushl %ecx");
asm(" .cfi_escape 0xf,0x3,0x75,0x74,0x6");
asm(" .cfi_escape 0x10,0x6,0x2,0x75,0x7c");
asm(" .cfi_escape 0x10,0x3,0x2,0x75,0x78");
asm(" movl $in, %esi");
asm(" movl $in+72, %ebx");
asm(" subl $428, %esp");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L19:");
asm(" subl $8, %esp");
asm(" pushl %esi");
asm(" pushl $.LC5");
asm(" addl $12, %esi");
asm(" call scanf");
asm(" addl $16, %esp");
asm(" cmpl %esi, %ebx");
asm(" jne .L19");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L20:");
asm(" subl $8, %esp");
asm(" pushl %ebx");
asm(" pushl $.LC5");
asm(" addl $12, %ebx");
asm(" call scanf");
asm(" addl $16, %esp");
asm(" cmpl $in+144, %ebx");
asm(" jne .L20");
asm(" fldt in");
asm(" movl $1000, %eax");
asm(" fstpt -152(%ebp)");
asm(" fldt in+72");
asm(" fstpt -248(%ebp)");
asm(" fldt in+12");
asm(" fstpt -104(%ebp)");
asm(" fldt in+84");
asm(" fstpt -232(%ebp)");
asm(" fldt in+24");
asm(" fstpt -136(%ebp)");
asm(" fldt in+96");
asm(" fstpt -184(%ebp)");
asm(" fldt in+36");
asm(" fstpt -120(%ebp)");
asm(" fldt in+108");
asm(" fstpt -216(%ebp)");
asm(" fldt in+48");
asm(" fstpt -72(%ebp)");
asm(" fldt in+120");
asm(" fstpt -168(%ebp)");
asm(" fldt in+60");
asm(" fstpt -88(%ebp)");
asm(" fldt in+132");
asm(" fstpt -200(%ebp)");
asm(" fld1");
asm(" fstpt -56(%ebp)");
asm(" fldz");
asm(" fstpt -40(%ebp)");
asm(" jmp .L47");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L85:");
asm(" fxch %st(1)");
asm(" fdivs .LC1");
asm(" fmul %st(1), %st");
asm(" fadds .LC2");
asm(" .L22:");
asm(" fldt -104(%ebp)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -296(%ebp)");
asm(" fldt -232(%ebp)");
asm(" fld %st(0)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -312(%ebp)");
asm(" fxch %st(2)");
asm(" fucomip %st(2), %st");
asm(" fstp %st(1)");
asm(" ja .L23");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L24:");
asm(" fldt -136(%ebp)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -328(%ebp)");
asm(" fldt -184(%ebp)");
asm(" fld %st(0)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -344(%ebp)");
asm(" fxch %st(2)");
asm(" fucomip %st(2), %st");
asm(" fstp %st(1)");
asm(" ja .L25");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L26:");
asm(" fldt -120(%ebp)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -360(%ebp)");
asm(" fldt -216(%ebp)");
asm(" fld %st(0)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -376(%ebp)");
asm(" fxch %st(2)");
asm(" fucomip %st(2), %st");
asm(" fstp %st(1)");
asm(" ja .L27");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L28:");
asm(" fldt -72(%ebp)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -392(%ebp)");
asm(" fldt -168(%ebp)");
asm(" fld %st(0)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -408(%ebp)");
asm(" fxch %st(2)");
asm(" fucomip %st(2), %st");
asm(" fstp %st(1)");
asm(" ja .L29");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L30:");
asm(" fldt -88(%ebp)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -424(%ebp)");
asm(" fldt -200(%ebp)");
asm(" fld %st(0)");
asm(" fmul %st(4), %st");
asm(" fld %st(0)");
asm(" fstpt -440(%ebp)");
asm(" fxch %st(2)");
asm(" fucomip %st(2), %st");
asm(" fstp %st(1)");
asm(" ja .L31");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L32:");
asm(" fld1");
asm(" fsub %st, %st(1)");
asm(" fsub %st(3), %st");
asm(" fldt -248(%ebp)");
asm(" fld %st(0)");
asm(" fmul %st(2), %st");
asm(" fldt -152(%ebp)");
asm(" fmul %st(6), %st");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L33");
asm(" fdivs .LC1");
asm(" fmul %st(1), %st");
asm(" fadds .LC2");
asm(" .L34:");
asm(" fldt -232(%ebp)");
asm(" fmul %st(2), %st");
asm(" fldt -104(%ebp)");
asm(" fmul %st(6), %st");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L35");
asm(" fldt -232(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L36:");
asm(" fldt -184(%ebp)");
asm(" fmul %st(2), %st");
asm(" fldt -136(%ebp)");
asm(" fmul %st(6), %st");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L37");
asm(" fldt -184(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L38:");
asm(" fldt -216(%ebp)");
asm(" fmul %st(2), %st");
asm(" fldt -120(%ebp)");
asm(" fmul %st(6), %st");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L39");
asm(" fldt -216(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L40:");
asm(" fldt -168(%ebp)");
asm(" fmul %st(2), %st");
asm(" fldt -72(%ebp)");
asm(" fmul %st(6), %st");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L41");
asm(" fldt -168(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" .L42:");
asm(" fldt -200(%ebp)");
asm(" fmul %st(2), %st");
asm(" fldt -88(%ebp)");
asm(" fmul %st(6), %st");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" ja .L43");
asm(" fldt -200(%ebp)");
asm(" fdivs .LC1");
asm(" fmulp %st, %st(2)");
asm(" faddp %st, %st(1)");
asm(" .L44:");
asm(" fsubrs .LC0");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" fldt -56(%ebp)");
asm(" fcmovbe %st(2), %st");
asm(" fstp %st(2)");
asm(" fxch %st(1)");
asm(" fstpt -56(%ebp)");
asm(" fldt -40(%ebp)");
asm(" fcmovnbe %st(2), %st");
asm(" subl $1, %eax");
asm(" fstpt -40(%ebp)");
asm(" je .L84");
asm(" fstp %st(0)");
asm(" fstp %st(0)");
asm(" .L47:");
asm(" fldt -56(%ebp)");
asm(" fldt -40(%ebp)");
asm(" fsubr %st, %st(1)");
asm(" fldt .LC8");
asm(" fdivr %st(2), %st");
asm(" fadd %st(1), %st");
asm(" fxch %st(2)");
asm(" fadd %st(0), %st");
asm(" fldt .LC8");
asm(" fdivrp %st, %st(1)");
asm(" faddp %st, %st(1)");
asm(" fldt -152(%ebp)");
asm(" fmul %st(2), %st");
asm(" fld %st(0)");
asm(" fstpt -264(%ebp)");
asm(" fld %st(2)");
asm(" fsubrs .LC0");
asm(" fldt -248(%ebp)");
asm(" fld %st(0)");
asm(" fmul %st(2), %st");
asm(" fld %st(0)");
asm(" fstpt -280(%ebp)");
asm(" fxch %st(3)");
asm(" fucomip %st(3), %st");
asm(" fstp %st(2)");
asm(" jbe .L85");
asm(" fstp %st(1)");
asm(" fldt -152(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" fadds .LC2");
asm(" jmp .L22");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L43:");
asm(" fstp %st(1)");
asm(" fldt -88(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(4), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L44");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L41:");
asm(" fldt -72(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(5), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L42");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L39:");
asm(" fldt -120(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(5), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L40");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L37:");
asm(" fldt -136(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(5), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L38");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L35:");
asm(" fldt -104(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(5), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L36");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L33:");
asm(" fstp %st(0)");
asm(" fldt -152(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(4), %st");
asm(" fadds .LC2");
asm(" jmp .L34");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L31:");
asm(" fstp %st(0)");
asm(" fldt -88(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(4), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L32");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L29:");
asm(" fstp %st(0)");
asm(" fldt -72(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(4), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L30");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L27:");
asm(" fstp %st(0)");
asm(" fldt -120(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(4), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L28");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L25:");
asm(" fstp %st(0)");
asm(" fldt -136(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(4), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L26");
asm(" .p2align 4,,10");
asm(" .p2align 3");
asm(" .L23:");
asm(" fstp %st(0)");
asm(" fldt -104(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(4), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L24");
asm(" .L84:");
asm(" fldt -264(%ebp)");
asm(" fldt -280(%ebp)");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" jbe .L77");
asm(" fldt -152(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" fadds .LC2");
asm(" .L50:");
asm(" fldt -296(%ebp)");
asm(" fldt -312(%ebp)");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" jbe .L78");
asm(" fldt -104(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" faddp %st, %st(1)");
asm(" .L53:");
asm(" fldt -328(%ebp)");
asm(" fldt -344(%ebp)");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" jbe .L79");
asm(" fldt -136(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" faddp %st, %st(1)");
asm(" .L56:");
asm(" fldt -360(%ebp)");
asm(" fldt -376(%ebp)");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" jbe .L80");
asm(" fldt -120(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" faddp %st, %st(1)");
asm(" .L59:");
asm(" fldt -392(%ebp)");
asm(" fldt -408(%ebp)");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" jbe .L81");
asm(" fldt -72(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(3), %st");
asm(" faddp %st, %st(1)");
asm(" .L62:");
asm(" fldt -424(%ebp)");
asm(" fldt -440(%ebp)");
asm(" fxch %st(1)");
asm(" fucomip %st(1), %st");
asm(" fstp %st(0)");
asm(" jbe .L82");
asm(" fstp %st(1)");
asm(" fldt -88(%ebp)");
asm(" fdivs .LC1");
asm(" fmulp %st, %st(2)");
asm(" faddp %st, %st(1)");
asm(" .L65:");
asm(" fld1");
asm(" subl $24, %esp");
asm(" fsub %st, %st(1)");
asm(" fsubp %st, %st(1)");
asm(" fstpt (%esp)");
asm(" pushl $.LC7");
asm(" pushl $1");
asm(" call __printf_chk");
asm(" addl $32, %esp");
asm(" leal -12(%ebp), %esp");
asm(" xorl %eax, %eax");
asm(" popl %ecx");
asm(" .cfi_remember_state");
asm(" .cfi_restore 1");
asm(" .cfi_def_cfa 1, 0");
asm(" popl %ebx");
asm(" .cfi_restore 3");
asm(" popl %esi");
asm(" .cfi_restore 6");
asm(" popl %ebp");
asm(" .cfi_restore 5");
asm(" leal -4(%ecx), %esp");
asm(" .cfi_def_cfa 4, 4");
asm(" ret");
asm(" .L77:");
asm(" .cfi_restore_state");
asm(" fldt -248(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(1), %st");
asm(" fadds .LC2");
asm(" jmp .L50");
asm(" .L82:");
asm(" fstp %st(2)");
asm(" fxch %st(1)");
asm(" fldt -200(%ebp)");
asm(" fdivs .LC1");
asm(" fmulp %st, %st(2)");
asm(" faddp %st, %st(1)");
asm(" jmp .L65");
asm(" .L81:");
asm(" fldt -168(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L62");
asm(" .L80:");
asm(" fldt -216(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L59");
asm(" .L79:");
asm(" fldt -184(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L56");
asm(" .L78:");
asm(" fldt -232(%ebp)");
asm(" fdivs .LC1");
asm(" fmul %st(2), %st");
asm(" faddp %st, %st(1)");
asm(" jmp .L53");
asm(" .cfi_endproc");
asm(" .LFE3715:");
asm(" .size main, .-main");
asm(" .section .text.unlikely");
asm(" .LCOLDE9:");
asm(" .section .text.startup");
asm(" .LHOTE9:");
asm(" .section .text.unlikely");
asm(" .LCOLDB10:");
asm(" .section .text.startup");
asm(" .LHOTB10:");
asm(" .p2align 4,,15");
asm(" .type _GLOBAL__sub_I_in, @function");
asm(" _GLOBAL__sub_I_in:");
asm(" .LFB3734:");
asm(" .cfi_startproc");
asm(" subl $24, %esp");
asm(" .cfi_def_cfa_offset 28");
asm(" pushl $_ZStL8__ioinit");
asm(" .cfi_def_cfa_offset 32");
asm(" call _ZNSt8ios_base4InitC1Ev");
asm(" addl $12, %esp");
asm(" .cfi_def_cfa_offset 20");
asm(" pushl $__dso_handle");
asm(" .cfi_def_cfa_offset 24");
asm(" pushl $_ZStL8__ioinit");
asm(" .cfi_def_cfa_offset 28");
asm(" pushl $_ZNSt8ios_base4InitD1Ev");
asm(" .cfi_def_cfa_offset 32");
asm(" call __cxa_atexit");
asm(" addl $28, %esp");
asm(" .cfi_def_cfa_offset 4");
asm(" ret");
asm(" .cfi_endproc");
asm(" .LFE3734:");
asm(" .size _GLOBAL__sub_I_in, .-_GLOBAL__sub_I_in");
asm(" .section .text.unlikely");
asm(" .LCOLDE10:");
asm(" .section .text.startup");
asm(" .LHOTE10:");
asm(" .section .init_array,\"aw\"");
asm(" .align 4");
asm(" .long _GLOBAL__sub_I_in");
asm(" .globl in");
asm(" .bss");
asm(" .align 32");
asm(" .type in, @object");
asm(" .size in, 144");
asm(" in:");
asm(" .zero 144");
asm(" .local _ZStL8__ioinit");
asm(" .comm _ZStL8__ioinit,1,1");
asm(" .section .rodata.cst4,\"aM\",@progbits,4");
asm(" .align 4");
asm(" .LC0:");
asm(" .long 1065353216");
asm(" .align 4");
asm(" .LC1:");
asm(" .long 1120403456");
asm(" .align 4");
asm(" .LC2:");
asm(" .long 0");
asm(" .section .rodata.cst16,\"aM\",@progbits,16");
asm(" .align 16");
asm(" .LC8:");
asm(" .long 0");
asm(" .long 3221225472");
asm(" .long 16384");
asm(" .align 16");
asm(" .hidden __dso_handle");
asm(" .ident \"GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609\"");
asm(" .section .note.GNU-stack,\"\",@progbits");
asm(" .ident \"GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609\"");
asm(" .section .note.GNU-stack,\"\",@progbits");
asm(" .ident \"GCC: (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609\"");
asm(" .section .note.GNU-stack,\"\",@progbits"); | /tmp/cc9Chqo6.s: Assembler messages:
/tmp/cc9Chqo6.s:177: Warning: unterminated string; newline inserted
/tmp/cc9Chqo6.s:192: Error: invalid instruction suffix for `push'
/tmp/cc9Chqo6.s:193: Error: invalid instruction suffix for `push'
/tmp/cc9Chqo6.s:196: Error: invalid instruction suffix for `push'
/tmp/cc9Chqo6.s:197: Error: invalid instruction suffix for `push'
/tmp/cc9Chqo6.s:198: Error: invalid instruction suffix for `push'
/tmp/cc9Chqo6.s:209: Error: invalid instruction suffix for `push'
/tmp/cc9Chqo6.s:210: Error: invalid instruction suffix for `push'
/tmp/cc9Chqo6.s:220: Error: invalid instruction suffix for `push'
/tmp/cc9Chqo6.s:221: Error: invalid instruction suffix for `push'
/tmp/cc9Chqo6.s:641: Error: invalid instruction suffix for `push'
/tmp/cc9Chqo6.s:642: Error: invalid instruction suffix for `push'
/tmp/cc9Chqo6.s:647: Error: invalid instruction suffix for `pop'
/tmp/cc9Chqo6.s:651: Error: invalid instruction suffix for `pop'
/tmp/cc9Chqo6.s:653: Error: invalid instruction suffix for `pop'
/tmp/cc9Chqo6.s:655: Error: invalid instruction suffix for `pop'
/tmp/cc9Chqo6.s:717: Error: invalid instruction suffix for `push'
/tmp/cc9Chqo6.s:722: Error: invalid instruction suffix for `push'
/tmp/cc9Chqo6.s:724: Error: invalid instruction suffix for `push'
/tmp/cc9Chqo6.s:726: Error: invalid instruction suffix for `push'
|
s411343786 | p03872 | C++ | #include<iostream>
#include<iomanip>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cassert>
#define PB push_back
#define MP make_pair
#define sz(v) (in((v).size()))
#define forn(i,n) for(in i=0;i<(n);++i)
#define forv(i,v) forn(i,sz(v))
#define fors(i,s) for(auto i=(s).begin();i!=(s).end();++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
typedef long long in;
typedef vector<in> VI;
typedef vector<VI> VVI;
in p2(in a){
return 1LL<<a;
}
struct unifnd{
VI ht,pr;
in fnd(in a){
in ta=a;
while(a!=pr[a])a=pr[a];
in tt=ta;
while(ta!=a){
tt=pr[ta];
pr[ta]=a;
ta=tt;
}
return a;
}
void uni(in a, in b){
a=fnd(a);
b=fnd(b);
if(a==b)return;
if(ht[b]<ht[a])swap(a,b);
pr[a]=b;
ht[b]+=(ht[a]==ht[b]);
}
void ini(in n){
ht.resize(n);
pr.resize(n);
forn(i,n){
ht[i]=0;
pr[i]=i;
}
}
};
unifnd tfd;
vector<double> x,y,a;
vector<double> bspan;
vector<pair<double,pair<in,in> > > egs;
double sq(double d){
return d*d;
}
double dist(in i, in j){
return sqrt(sq(x[i]-x[j])+sq(y[i]-y[j]));
}
vector<double> btot;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
in n;
cin>>n;
x=y=a=vector<double>(n);
forn(i,n){
cin>>x[i]>>y[i]>>a[i];
}
forn(i,n){
forn(j,i){
egs.PB(MP(dist(i,j),MP(i,j)));
}
}
sort(all(egs));
bspan.resize(p2(n));
bspan[0]=2e9;
in ta,tb;
forn(msk,p2(n)){
if(!msk)
continue;
double tsm=0;
in tcnt=0;
tfd.ini(n);
forn(i,n){
if(msk&p2(i)){
tsm+=a[i];
++tcnt;
}
}
for(auto& eg:egs){
ta=eg.second.first;
tb=eg.second.second;
if((msk&p2(ta))&&(msk&p2(tb))){
if(tfd.fnd(ta)!=tfd.fnd(tb)){
tfd.uni(ta,tb);
tsm-=eg.first;
}
}
}
bspan[msk]=max(0.0,tsm/tcnt);
}
btot.resize(p2(n));
btot[0]=2e9;
forn(msk,p2(n)){
if(!msk)
continue;
for(in lmsk=msk;lmsk>0;lmsk=(lmsk-1)&msk){
btot[msk]=max(btot[msk],min(btot[msk^lmsk],bspan[lmsk]));
}
}
cout<<setprecision(15);
cout<<btot[p2(n)-1]<<endl;
return 0;
}
| a.cc: In function 'double dist(in, in)':
a.cc:61:10: error: 'sqrt' was not declared in this scope; did you mean 'sq'?
61 | return sqrt(sq(x[i]-x[j])+sq(y[i]-y[j]));
| ^~~~
| sq
|
s398138980 | p03872 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
const double eps = 1e-8;
///////////////////////////
//SIMPLEX
//WARNING: segfaults on empty (size 0)
//max cx st Ax<=b, x>=0
//do 2 phases; 1st check feasibility;
//2nd check boundedness & ans
///////////////////////////
vector<double> simplex(vector<vector<double> > A, vector<double> b, vector<double> c) {
int n = (int) A.size(), m = (int) A[0].size()+1, r = n, s = m-1;
vector<vector<double> > D = vector<vector<double> > (n+2, vector<double>(m+1));
vector<int> ix = vector<int> (n+m);
for (int i=0; i<n+m; i++) ix[i] = i;
for (int i=0; i<n; i++) {
for (int j=0; j<m-1; j++)D[i][j]=-A[i][j];
D[i][m-1] = 1;
D[i][m] = b[i];
if (D[r][m] > D[i][m]) r = i;
}
for (int j=0; j<m-1; j++) D[n][j]=c[j];
D[n+1][m-1] = -1; int z = 0;
for (double d;;) {
if (r < n) {
swap(ix[s], ix[r+m]);
D[r][s] = 1.0/D[r][s];
for (int j=0; j<=m; j++) if (j!=s) D[r][j] *= -D[r][s];
for(int i=0; i<=n+1; i++)if(i!=r) {
for (int j=0; j<=m; j++) if(j!=s) D[i][j] += D[r][j] * D[i][s];
D[i][s] *= D[r][s];
}
}
r = -1; s = -1;
for (int j=0; j <m; j++) if (s<0 || ix[s]>ix[j]) {
if (D[n+1][j]>eps || D[n+1][j]>-eps && D[n][j]>eps) s = j;
}
if (s < 0) break;
for (int i=0; i<n; i++) if(D[i][s]<-eps) {
if (r < 0 || (d = D[r][m]/D[r][s]-D[i][m]/D[i][s]) < -eps
|| d < eps && ix[r+m] > ix[i+m]) r=i;
}
if (r < 0) return vector<double>(); // unbounded
}
if (D[n+1][m] < -eps) return vector<double>(); // infeasible
vector<double> x(m-1);
for (int i = m; i < n+m; i ++) if (ix[i] < m-1) x[ix[i]] = D[i-m][m];
printf("%.2lf\n", D[n][m]);
return x; // ans: D[n][m]
}
#define N 16
int n;
int px[N], py[N], pz[i];
double d[N][N];
double a[N];
int p[N];
bool cmp(int x, int y) {
return fabs(p[x]) > fabs(p[y]);
}
bool can(double val) {
for (int i = 0; i < n; i ++)
a[i] = pz[i]-val;
while (true) {
bool done = true;
for (int i = 0; i < n; i ++)
if (a[i] < 0.0) done = false;
if (done) return true;
for (int i = 0; i < n; i ++) p[i] = i;
sort(p, p+n, cmp);
if (fabs(a[p[i]]) < eps) break;
int j = p[0];
int be = -1;
for (int i = 0; i < n; i++)
if (fabs(a[i]) > eps && i != j && a[i] * a[j] < 0) {
if (be == -1) be = i;
else if (d[be][j] > d[i][j]) be = i;
}
if (a[j] < 0) swap(be, j);
if (a[j] < d[be][j]) return false;
double amt = a[j]-d[be][j];
amt = min(amt, -a[be]);
a[j] -= amt;
a[be] += amt;
}
return false;
}
int main () {
cin >> n;
for (int i = 0; i < n; i ++)
cin >> px[i] >> py[i] >> pz[i];
for (int i = 0; i < n; i ++)
for (int j = 0; j < n; j ++)
d[i][j] = sqrt((px[i]-px[j])*(px[i]-px[j]) + (py[i]-py[j])*(py[i]-py[j]));
double le = 0, ri = 1e9;
for (int _ = 0; _ < 100; _++) {
double mid = (le+ri)/2;
if (can(mid)) le = mid;
else ri = mid;
}
printf ("%.9lf\n", (le+ri)/2);
/*
int nc = n*n*2+1;
int cc = n*n*2;
vector<double> C(nc, 0.0);
C[cc] = 1.0;
vector<vector<double> > A;
vector<double> B;
for (int i = 0; i < n; i ++) {
for (int j = 0; j < n; j ++) {
vector<double> v(nc, 0.0);
}
}
printf ("%.9lf\n", simplex(A, B, C));*/
return 0;
} | a.cc:64:22: error: 'i' was not declared in this scope
64 | int px[N], py[N], pz[i];
| ^
a.cc: In function 'bool can(double)':
a.cc:76:24: error: 'pz' was not declared in this scope; did you mean 'py'?
76 | a[i] = pz[i]-val;
| ^~
| py
a.cc:84:30: error: 'i' was not declared in this scope
84 | if (fabs(a[p[i]]) < eps) break;
| ^
a.cc: In function 'int main()':
a.cc:105:42: error: 'pz' was not declared in this scope; did you mean 'py'?
105 | cin >> px[i] >> py[i] >> pz[i];
| ^~
| py
|
s953632827 | p03873 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef __int128_t LL;
#define p pair<LL,LL>
#define x first
#define y second
LL dp[10000][10000];
int main(){
LL n;
cin >> n;
p val[n];
for(LL i = 0; i < n; i++) cin >> val[i].x >> val[i].y;
for(LL i = 0; i < n; i++){
val[i].x += val[i].y;
}
LL ans = 0;
sort(val,val+n);
reverse(val,val+n);
for(LL i = 0; i < n; i++){
val[i].x -= val[i].y;
}
LL k = n/2;
for(LL i = 0; i <= k; i++){
for(LL j = 0; j <= k; j++){
dp[i][j] = (LL)1e15;
}
}
dp[0][0] = 0;
for(LL i = 0; i <= k; i++){
for(LL j = 0; j <= k; j++){
if(i > 0){
dp[i][j] = min(dp[i][j], dp[i-1][j] +(i-1)*val[i+j-1].x + (i)*val[i+j-1].y);
}
if(j > 0){
dp[i][j] = min(dp[i][j], dp[i][j-1] +(j)*val[i+j-1].x + (j-1)*val[i+j-1].y);
}
//cout << dp[i][j] << " ";
}
//cout << endl;
}
LL r = dp[k][k];
if((n % 2) == 1){
r += k*val[n-1].x;
r += k*val[n-1].y;
}
if(n == 1){
cout <<0 << endl;
return 0;
} else if(n == 2){
cout << min(val[0].x+val[1].y,val[1].x+val[0].y);
return 0;
}
cout << r << endl;
}
| a.cc: In function 'int main()':
a.cc:11:13: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'LL' {aka '__int128'})
11 | cin >> n;
| ~~~ ^~ ~
| | |
| | LL {aka __int128}
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'double&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: invalid conversion from 'LL' {aka '__int128'} to 'void*' [-fpermissive]
11 | cin >> n;
| ^
| |
| LL {aka __int128}
a.cc:11:16: error: cannot bind rvalue '(void*)((long int)n)' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: invalid conversion from 'LL' {aka '__int128'} to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive]
11 | cin >> n;
| ^
| |
| LL {aka __int128}
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' (near match)
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: invalid conversion from 'LL' {aka '__int128'} to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} [-fpermissive]
11 | cin >> n;
| ^
| |
| LL {aka __int128}
/usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__i |
s495277196 | p03873 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef __int128 LL;
#define p pair<LL,LL>
#define x first
#define y second
LL dp[10000][10000];
int main(){
LL n;
cin >> n;
p val[n];
for(LL i = 0; i < n; i++) cin >> val[i].x >> val[i].y;
for(LL i = 0; i < n; i++){
val[i].x += val[i].y;
}
LL ans = 0;
sort(val,val+n);
reverse(val,val+n);
for(LL i = 0; i < n; i++){
val[i].x -= val[i].y;
}
LL k = n/2;
for(LL i = 0; i <= k; i++){
for(LL j = 0; j <= k; j++){
dp[i][j] = (LL)1e15;
}
}
dp[0][0] = 0;
for(LL i = 0; i <= k; i++){
for(LL j = 0; j <= k; j++){
if(i > 0){
dp[i][j] = min(dp[i][j], dp[i-1][j] +(i-1)*val[i+j-1].x + (i)*val[i+j-1].y);
}
if(j > 0){
dp[i][j] = min(dp[i][j], dp[i][j-1] +(j)*val[i+j-1].x + (j-1)*val[i+j-1].y);
}
//cout << dp[i][j] << " ";
}
//cout << endl;
}
LL r = dp[k][k];
if((n % 2) == 1){
r += k*val[n-1].x;
r += k*val[n-1].y;
}
if(n == 1){
cout <<0 << endl;
return 0;
} else if(n == 2){
cout << min(val[0].x+val[1].y,val[1].x+val[0].y);
return 0;
}
cout << r << endl;
}
| a.cc: In function 'int main()':
a.cc:11:13: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'LL' {aka '__int128'})
11 | cin >> n;
| ~~~ ^~ ~
| | |
| | LL {aka __int128}
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'double&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type 'LL' {aka '__int128'}
11 | cin >> n;
| ^
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: invalid conversion from 'LL' {aka '__int128'} to 'void*' [-fpermissive]
11 | cin >> n;
| ^
| |
| LL {aka __int128}
a.cc:11:16: error: cannot bind rvalue '(void*)((long int)n)' to 'void*&'
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: invalid conversion from 'LL' {aka '__int128'} to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'} [-fpermissive]
11 | cin >> n;
| ^
| |
| LL {aka __int128}
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]' (near match)
126 | operator>>(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:126:7: note: conversion of argument 1 would be ill-formed:
a.cc:11:16: error: invalid conversion from 'LL' {aka '__int128'} to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'} [-fpermissive]
11 | cin >> n;
| ^
| |
| LL {aka __int128}
/usr/include/c++/14/istream:133:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__i |
s455305465 | p03873 | C++ | #include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <bitset>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <queue>
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef long double ld;
using namespace std;
vector<pair<ll, ll> > vv;
const ll INF = 9
e18;
int n;
ll dp[2][5100];
ll dp2[2][5100];
int main() {
scanf("%d", &n);
for (int i = 0; i < n; ++i) {
int l, r;
scanf("%d%d", &l, &r);
vv.push_back(make_pair(l + r, l));
}
sort(vv.begin(), vv.end());
reverse(vv.begin(), vv.end());
for (int i = 0; i <= n; ++i)
dp[0][i] = dp[1][i] = INF;
dp[0][0] = 0;
for (int i = 0; i < (int)vv.size(); ++i) {
for (int j = 0; j <= n; ++j)
dp2[0][j] = dp2[1][j] = INF;
for (int j = 0; j <= i; ++j) {
dp2[0][j + 1] = min(dp2[0][j + 1], dp[0][j] + vv[i].first * j + (vv[i].first - vv[i].second));
dp2[0][j] = min(dp2[0][j], dp[0][j] + vv[i].first * (i - j) + (vv[i].second));
}
if (n % 2 == 0) {
for (int j = 0; j <= n; ++j) {
dp[0][j] = dp2[0][j], dp[1][j] = dp2[1][j];
}
continue;
}
for (int j = 0; j <= i; ++j) {
dp2[1][j + 1] = min(dp2[1][j + 1], dp[1][j] + vv[i].first * j + (vv[i].first - vv[i].second));
dp2[1][j] = min(dp2[1][j], dp[1][j] + vv[i].first * (i - j) + (vv[i].second));
dp2[1][j] = min(dp2[1][j], dp2[0][j] + ((n - 1) / 2) * vv[i].first);
}
for (int j = 0; j <= n; ++j) {
dp[0][j] = dp2[0][j], dp[1][j] = dp2[1][j];
}
}
if (n % 2 == 0) {
cout << dp[0][n / 2] << "\n";
}
else {
cout << dp[1][n / 2] << "\n";
}
return 0;
}
| a.cc:27:1: error: expected ',' or ';' before 'e18'
27 | e18;
| ^~~
|
s818085020 | p03873 | C++ | #include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <random>
#include <vector>
#include <array>
#include <bitset>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
int bsr(int x) { return 31 - __builtin_clz(x); }
const int MN = 5050;
using P = pair<ll, ll>;
int n;
vector<P> v;
ll dp[MN][MN];
bool used[MN][MN];
ll calc(int m, int a) {
if (m == 0) return 0;
int b = n/2 - ((n-m)-(n/2-a));
if (used[m][a]) return dp[m][a];
used[m][a] = true;
ll &ans = dp[m][a];
ans = TEN(18);
P p = v[m-1];
// left
if (a) {
ll x = p.first*(a-1);
x += p.second*(a);
ans = min(ans, x + calc(m-1, a-1));
}
// right
if (b) {
ll x = p.first*(b);
x += p.second*(b-1);
ans = min(ans, x + calc(m-1, a));
}
return ans;
}
ll main2() {
memset(used, false, sizeof(used));
ll ans = 0;
if (n % 2 == 1) {
// 演算子の優先順位には…気をつけようね!
ans += (v[n-1].first+v[n-1].second)*(n/2);
n--;
}
return ans + calc(n, n/2);
}
int main() {
ios::sync_with_stdio(0);
cout << setprecision(20);
int nn;
cin >> nn;
n = nn;
for (int i = 0; i < n; i++) {
ll l, r;
cin >> l >> r;
v.push_back(P(l, r));
}
ll ans = TEN(18);
sort(v.begin(), v.end(), [&](const P l, const P r){
ll ls = l.first+l.second;
ll rs = r.first+r.second;
if (ls != rs) return ls > rs;
return l.first > r.first;
});
ans = min(ans, main2());
n = nn;
sort(v.begin(), v.end(), [&](const P l, const P r){
ll ls = l.first+l.second;
ll rs = r.first+r.second;
if (ls != rs) return ls > rs;
return l.second > r.second;
});
ans = min(ans, main2());
cout << ans << endl;
return 0;
}
| a.cc: In function 'll main2()':
a.cc:54:5: error: 'memset' was not declared in this scope
54 | memset(used, false, sizeof(used));
| ^~~~~~
a.cc:16:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
15 | #include <unordered_map>
+++ |+#include <cstring>
16 |
|
s882401515 | p03874 | C++ | #include <iostream>
#include <string>
using namespace std;
long long K, dp[555]; string S;
int main() {
cin >> K;
for (int i = 0; i <= 550; i++) {
unsigned long long R = 1;
for (int j = i + 1; j <= i + 7; j++) R *= j;
R /= 5040;
dp[i] = R;
}
for (int i = 549; i >= 0; i--) {
while (K >= dp[i]) { S += "L"; K -= dp[i]; }
S += "AVITSEF";
}
reverse(S.begin(), S.end());
cout << S << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:19:9: error: 'reverse' was not declared in this scope
19 | reverse(S.begin(), S.end());
| ^~~~~~~
|
s925150735 | p03875 | C++ | 2
0 1
1 0 | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 2
| ^
|
s810707752 | p03876 | C++ | e polygon is simple (see notes for the definition).
Each edge of the polygon is parallel to one of the coordinate axes.
Each coordinate is an integer between 0 and 10^9, inclusive.
The vertices are numbered 1 through N in counter-clockwise order.
The internal angle at the i-th vertex is exactly a_i degrees.
| a.cc:1:1: error: 'e' does not name a type
1 | e polygon is simple (see notes for the definition).
| ^
|
s520217895 | p03878 | C | #include <iostream>
#include <iomanip>
#include <map>
#include <unordered_map>
#include <list>
#include <set>
#include <unordered_set>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdint>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#define rep(i, n) for(ll (i) = 0;(i) < (n);(i)++)
#define mp(a, b) make_pair((a),(b))
#define bs(n) ((ull)1<<(ull)n)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
constexpr ll inf = INT64_MAX / 4;
constexpr double pi = asin(1) * 2;
constexpr ll mod = 1000000007;
constexpr double eps = 0.000000001;
ll dp[100001];
ll fac(ll n) {
if (n == 0)return 1;
if (dp[n] == 0)dp[n] = (fac(n - 1) * n) % mod;
return dp[n];
}
int main() {
ll n;
cin >> n;
auto a = new pair<ll, ll>[n * 2];
rep(i, n * 2) {
cin >> a[i].first;
a[i].second = (i < n ? -1 : 1);
}
sort(a, a + (n * 2));
list<ll> v;
ll c = 0, p = 0;
rep(i, n * 2) {
if (p != 0 && (a[i].second > 0 ^ p > 0)) {
c++;
} else if (c) {
v.push_back(c);
c = 0;
}
p += a[i].second;
}
if (c) v.push_back(c);
ll r = 1;
for (auto &e:v) r = (r *fac(e)) % mod;
cout << r << endl;
}
| main.c:1:10: fatal error: iostream: No such file or directory
1 | #include <iostream>
| ^~~~~~~~~~
compilation terminated.
|
s170645997 | p03878 | C++ | #include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll MOD = 1000000007;
int main()
{
int n;
cin >> n;
int a[100002], b[100002];
P p[200002];
for(int i = 0; i < n; i++){
cin >> a[i];
p[i] = P(a[i], 0);
}
for(int i = 0; i < n; i++){
cin >> b[i];
p[n + i] = P(b[i], 1);
}
sort(p, p + n * 2);
ll r = 0;
ll ans = 1;
for(int i = 0; i < n * 2; i++){
if(p[i].second == 0){
if(r < 0) ans = ans * -r % MOD;
r++;
}
else{
if(r > 0) ans = ans * r % MOD;
r--;
}
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:22:5: error: 'sort' was not declared in this scope; did you mean 'short'?
22 | sort(p, p + n * 2);
| ^~~~
| short
|
s850953136 | p03878 | C++ | #include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
#define llint long long
#define mod 1000000007
using namespace std;
llint n;
vector<pair<llint, llint> > vec;
int main(void)
{
cin >> n;
llint x;
for(int i = 1; i <= n; i++){
cin >> x;
vec.push_back(make_pair(x, 1));
}
for(int i = 1; i <= n; i++){
cin >> x;
vec.push_back(make_pair(x, 2));
}
sort(vec.begin(), vec.end());
llint cnt = 0, cnt2 = 0, ans = 0;
for(int i = 0; i < vec.size(); i++){
if(vec[i].second == 1){
if(cnt2 == 0) cnt1++;
else ans *= cnt2, ans %= mod, cnt2--;
}
else{
if(cnt1 == 0) cnt2++;
else ans *= cnt1, ans %= mod, cnt1--;
}
}
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:30:21: error: 'cnt1' was not declared in this scope; did you mean 'cnt2'?
30 | if(cnt2 == 0) cnt1++;
| ^~~~
| cnt2
a.cc:34:10: error: 'cnt1' was not declared in this scope; did you mean 'cnt2'?
34 | if(cnt1 == 0) cnt2++;
| ^~~~
| cnt2
|
s963995338 | p03878 | C++ | $N=<>;$\=1;($\*=($p=$%)<($%=abs($c+=$_>$N||-1))||$p)%=1e9+7for`nl|sort -nk2`;print | a.cc:1:8: error: stray '\' in program
1 | $N=<>;$\=1;($\*=($p=$%)<($%=abs($c+=$_>$N||-1))||$p)%=1e9+7for`nl|sort -nk2`;print
| ^
a.cc:1:14: error: stray '\' in program
1 | $N=<>;$\=1;($\*=($p=$%)<($%=abs($c+=$_>$N||-1))||$p)%=1e9+7for`nl|sort -nk2`;print
| ^
a.cc:1:63: error: stray '`' in program
1 | $N=<>;$\=1;($\*=($p=$%)<($%=abs($c+=$_>$N||-1))||$p)%=1e9+7for`nl|sort -nk2`;print
| ^
a.cc:1:76: error: stray '`' in program
1 | $N=<>;$\=1;($\*=($p=$%)<($%=abs($c+=$_>$N||-1))||$p)%=1e9+7for`nl|sort -nk2`;print
| ^
a.cc:1:1: error: '$N' does not name a type
1 | $N=<>;$\=1;($\*=($p=$%)<($%=abs($c+=$_>$N||-1))||$p)%=1e9+7for`nl|sort -nk2`;print
| ^~
a.cc:1:7: error: '$' does not name a type
1 | $N=<>;$\=1;($\*=($p=$%)<($%=abs($c+=$_>$N||-1))||$p)%=1e9+7for`nl|sort -nk2`;print
| ^
a.cc:1:14: error: expected ')' before '*=' token
1 | $N=<>;$\=1;($\*=($p=$%)<($%=abs($c+=$_>$N||-1))||$p)%=1e9+7for`nl|sort -nk2`;print
| ~ ^~~
| )
a.cc:1:78: error: 'print' does not name a type; did you mean 'int'?
1 | $N=<>;$\=1;($\*=($p=$%)<($%=abs($c+=$_>$N||-1))||$p)%=1e9+7for`nl|sort -nk2`;print
| ^~~~~
| int
|
s109658994 | p03878 | C++ | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define ve vector
#define vi vector<int>
#define vp vector<pair<int,int>>
#define vvi vector<vector<int>>
typedef long long ll;
const ll INF = LLONG_MAX - 100;
const ll mod = 1e9 + 7;
const int MAX_N = 2e5 + 5;
int dx[] = {-1,0,1,0}, dy[] = {0,1,0,-1};
vector<ll> prime;
int fac[MAX_N], inv[MAX_N];
template <class T = ll> T in() {T x; cin >> x; return (x);}
void DEBUG(vector<int> a) {for(int i=0;i<a.size();i++){cout<<a[i]<<" ";cout<<endl;}}
ll GCD(ll a, ll b) {ll c; while (b != 0) {c = a % b; a = b; b = c;}return a;}
ll LCM(ll a, ll b) {return a * b / GCD(a, b);}
ll POW(ll a, ll b) {ll c = 1LL; while (b > 0) {if (b & 1LL) {c = a * c%mod;}a = a * a%mod; b >>= 1LL;}return c;}
void _nCr() {fac[0] = 1LL; for (int i = 1LL; i < MAX_N; i++) {fac[i] = fac[i - 1LL] * i%mod;}for (int i = 0; i < MAX_N; i++) {inv[i] = POW(fac[i], mod - 2);}}
ll nCr(ll n, ll r) {return (fac[n] * inv[r] % mod)*inv[n - r] % mod;}
void PRI(ll n) {bool a[n + 1LL]; for (int i = 0; i < n + 1LL; i++) {a[i] = 1LL;}for (int i = 2; i < n + 1LL; i++) {if (a[i]) {prime.pb(i); ll b = i; while (b <= n) {a[b] = 0; b += i;}}}}
template <typename T> T chmin(T& a, T b) {if(a>b)a=b;return a;}
template <typename T> T chmax(T& a, T b) {if(a<b)a=b;return b;}
bool solve() {
int n; cin >> n;
vp A(n);
REP (i,n) {
int x; cin >> x; A.pb(x,1);
}
REP (i,n) {
int x; cin >> x; A.pb(x,-1);
}
sort(ALL(A));
int ans = 1;
int cnt = 0;
for (auto a : A) {
int delta = a.second;
if (cnt != 0 && (cnt > 0) != a.second) {
ans *= abs(cnt); ans %= mod;
}
cnt += delta;
}
cout << ans << endl;
}
signed main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
} | a.cc: In function 'bool solve()':
a.cc:43:38: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(long long int&, int)'
43 | int x; cin >> x; A.pb(x,1);
| ~~~~^~~~~
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate expects 1 argument, 2 provided
a.cc:46:38: error: no matching function for call to 'std::vector<std::pair<long long int, long long int> >::push_back(long long int&, int)'
46 | int x; cin >> x; A.pb(x,-1);
| ~~~~^~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
1283 | push_back(const value_type& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = std::pair<long long int, long long int>; _Alloc = std::allocator<std::pair<long long int, long long int> >; value_type = std::pair<long long int, long long int>]'
1300 | push_back(value_type&& __x)
| ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate expects 1 argument, 2 provided
a.cc:59:1: warning: no return statement in function returning non-void [-Wreturn-type]
59 | }
| ^
|
s834586609 | p03878 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
const int mod=1000000007;
int main(){
int n;cin>>n;
int a[n],b[n];
vector<P> x(2*n);
rep(i,n){
int a;cin>>a;
x[i]=P(a,1);
}
rep(i,n){
int b;cin>>b;
x[i+n]=P(b,2);
}
sort(all(x));
int ctr=0;
ll ans=1;
int now=0;
rep(i,2*n){
if(x[i].second==1)ctr++;
else ctr--;
if(ctr==0){
int pw=0;
for(int j=i;j>=now;--j){
if(x[j].second==2)pw++;
else{
ans*=pw;ans%=mod;
}
pw--;
}
}
now=i+1;
}
}
cout<<ans<<endl;
}
| a.cc:48:5: error: 'cout' does not name a type
48 | cout<<ans<<endl;
| ^~~~
a.cc:49:1: error: expected declaration before '}' token
49 | }
| ^
|
s456430303 | p03878 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
const ll MOD=1e9+7;
int main(){
ll N,ans=1,a;
cin >> N;
priority_queue<P> Q;
FOR(i,0,N)cin>>a,Q.push({-a,-1});
FOR(i,0,N)cin>>a,Q.push({-a,1});
a = 0;
while(!Q.empty()){
if(a != Q.top().second*llabs(a))
(ans *= llabs(a) )%=MOD;
a+=Q.top().second;
Q.pop();
}
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:9:24: error: 'P' was not declared in this scope
9 | priority_queue<P> Q;
| ^
a.cc:9:25: error: template argument 1 is invalid
9 | priority_queue<P> Q;
| ^
a.cc:9:25: error: template argument 2 is invalid
a.cc:9:25: error: template argument 3 is invalid
a.cc:10:28: error: request for member 'push' in 'Q', which is of non-class type 'int'
10 | FOR(i,0,N)cin>>a,Q.push({-a,-1});
| ^~~~
a.cc:11:28: error: request for member 'push' in 'Q', which is of non-class type 'int'
11 | FOR(i,0,N)cin>>a,Q.push({-a,1});
| ^~~~
a.cc:13:18: error: request for member 'empty' in 'Q', which is of non-class type 'int'
13 | while(!Q.empty()){
| ^~~~~
a.cc:14:27: error: request for member 'top' in 'Q', which is of non-class type 'int'
14 | if(a != Q.top().second*llabs(a))
| ^~~
a.cc:16:22: error: request for member 'top' in 'Q', which is of non-class type 'int'
16 | a+=Q.top().second;
| ^~~
a.cc:17:19: error: request for member 'pop' in 'Q', which is of non-class type 'int'
17 | Q.pop();
| ^~~
|
s564634990 | p03878 | C++ | #include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define int ll
#define rep(i, a) for (int i = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int i = (int) (a); (i) < (int) (b); (i)++)
#define rrep(i, a) for (int i = (int) a-1; (i) >= 0; (i)--)
#define rreps(i, a, b) for (int i = (int) (a)-1; (i) >= (int) (b); (i)--)
#define MP(a, b) make_pair((a), (b))
#define PB(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PERM(v) next_permutation(all(v))
#define UNIQUE(v) sort(all(v));(v).erase(unique(all(v)), v.end())
#define CIN(type, x) type x;cin >> x
#define TRUE__ "Yes"
#define FALSE__ "No"
#define PRINT(f) if((f)){cout << (TRUE__) << endl;}else{cout << FALSE__ << endl;}
#define YES(f) if((f)){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(f) if((f)){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define MINV(v) min_element(all(v))
#define MAXV(v) max_element(all(v))
#define MIN3(a, b, c) min(min(a, b), c)
#define MIN4(a, b, c, d) min(MIN3(a, b, c), d)
#define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e)
#define MIN6(a, b, c, d, e, f) min(MIN5(a, b, c, d, e), f)
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(MAX3(a, b, c), d)
#define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e)
#define MAX6(a, b, c, d, e, f) max(MAX5(a, b, c, d, e), f)
#define RANGE(a, b, c) ((a) <= (b) && (b) < (c))
#define RANGE2D(a, b, c, d, e, f) (RANGE((a), (c), (e)) && RANGE((b), (d), (f)))
#define chmin(a, b) a = min(a, (b))
#define chmin3(a, b, c) a = MIN3(a, (b), (c))
#define chmin4(a, b, c, d) a = MIN4(a, (b), (c), (d))
#define chmin5(a, b, c, d, e) a = MIN5(a, (b), (c), (d), (e))
#define chmin6(a, b, c, d, e, f) a = MIN6(a, (b), (c), (d), (e), (f))
#define chmax(a, b) a = max(a, (b))
#define chmax3(a, b, c) a = MAX3(a, (b), (c))
#define chmax4(a, b, c, d) a = MAX4(a, (b), (c), (d))
#define chmax5(a, b, c, d, e) a = MAX5(a, (b), (c), (d), (e))
#define chmax6(a, b, c, d, e, f) a = MAX6(a, (b), (c), (d), (e), (f))
#define fcout cout << fixed << setprecision(12)
#define RS resize
#define CINV(v, N) do {\
v.RS(N);\
rep(i, N) cin >> v[i];\
} while (0);
#define RCINV(v, N) do {\
v.RS(N);\
rrep(i, N) cin >> v[i];\
} while (0);
#define MOD 1000000007
template<class T>
inline T GET() {
T x;
cin >> x;
return x;
}
void init();
void solve();
signed main()
{
init();
solve();
}
int N;
vector<int> v;
void init()
{
vector<pair<int, int>> vt;
cin >> N;
rep(i, N) {
int t;
cin >> t;
vt.PB(MP(t, 0));
}
rep(i, N) {
int t;
cin >> t;
vt.PB(MP(t, 1));
}
sort(all(vt));
v.PB(1);
int n = vt[0].second;
reps(i, 1, 2*N) {
if (n == vt[i].second) v.back()++;
else {
v.PB(1);
n = 1 - n;
}
}
}
struct comb {
#define MOD_COMB 1000000007
vector<ll> fact;
vector<ll> facti;
comb(int n) {
init(n);
}
void init(int n) {
fact.resize(n);
facti.resize(n);
fact[0] = 1;
for (int i = 1; i < n; i++) {
fact[i] = fact[i-1] * i % MOD_COMB;
}
facti[n-1] = po(fact[n-1], MOD_COMB - 2);
for (int i = n-2; i >= 0; i--) {
facti[i] = facti[i+1] * (i + 1) % MOD_COMB;
}
}
ll nCr(int a, int b) {
return (fact[a] * facti[b] % MOD_COMB) * facti[a-b] % MOD_COMB;
}
ll nPr(int a, int b) {
return fact[a] * facti[a-b] % MOD_COMB;
}
private:
ll po(ll next, int cnt) {
ll res = 1;
if (cnt == 0) return 1;
if (cnt & 1) res = res * next % MOD_COMB;
return res * po(next * next % MOD_COMB, cnt >> 1) % MOD_COMB;
}
};
void solve()
{
int x[2] = {0, 0};
comb c(312345);
int res = 1;
rep(i, v.size()) {
int g = i % 2;
x[g] += v[i];
int mi = min(x[0], x[1]);
int ma = max(x[0], x[1]);
if (x[ng] != ma) ma = mi;
res *= c.nPr(ma, mi);
res %= MOD;
x[0] -= mi;
x[1] -= mi;
}
cout << res << endl;
}
| a.cc: In function 'void solve()':
a.cc:149:23: error: 'ng' was not declared in this scope; did you mean 'g'?
149 | if (x[ng] != ma) ma = mi;
| ^~
| g
|
s006445027 | p03878 | C++ | #include <bits/stdc++.h>
using LL = long long;
const LL MOD = 1e9+9;
using namespace std;
int main(){
int N;cin >> N;
vector<LL> pc,outlet;
for(int a = 0;a < N;a++){
LL b;cin >> b;
pc.push_back(b);
}
for(int a = 0;a < N;a++){
LL b;cin >> b;
outlet.push_back(b);
}
vector<pair<int,int>> vec1,vec2;
sort(pc.begin(),pc.end());
sort(outlet.begin(),outlet.end());
string flag;
for(int a = 0;a < N;a++){
if(pc.at(a) < outlet.at(a)){
flag.push_back('L');
vec1.push_back({pc.at(a),outlet.at(a)});
}else{
flag.push_back('R');
vec2.push_back({pc.at(a),outlet.at(a)});
}
}
LL ans1 = 1;
LL ans2 = 1;
for(int a = 0;a < vec1.size();a++){
int ok = a;
int ng = vec1.size();
while(abs(ng - ok) > 1){
int mid = (ok+ng)/2;
if(vec1.at(mid).first < vec1.at(a).second){
ok = mid;
}else{
ng = mid;
}
}
// cout<<ok<<endl;
ans1 += (ok-a);
}
for(int a = vec2.size()-1;a >= 0;a--){
int ok = a;
int ng = -1;
while(abs(ok-ng) > 1){
int mid = (ok+ng)/2;
if(vec2.at(mid).first > vec2.at(a).second){
ok = mid;
3
3
10
8
7
12
5 }else{
ng = mid;
}
}
// cout<<ok<<endl;
ans2 += abs(ok-a);
}
cout<<(ans1*ans2)%MOD<<endl;
}
| a.cc: In function 'int main()':
a.cc:53:10: error: expected ';' before numeric constant
53 | 3
| ^
| ;
54 | 3
| ~
|
s075740390 | p03878 | C++ | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<set>
#include<map>
#include<queue>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);++i)
#define rrep(i,n) for(int (i)=(n)-1;(i)>=0;--i)
#define rep1(i,n) for(int (i)=1;(i)<=(n);++i)
#define rrep1(i,n) for(int (i)=(n);(i)>=1;--i)
#define pb push_back
#define fr first
#define sc second
#define int long long
typedef int ss;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<long long,long long> LP;
typedef double db;
using namespace std;
ll N;
ll A[100000];
ll B[100000];
vector<ll> xs;
ll w[200000];
vector<ll> F;
ll mod = 1e+9 + 7;
ll jo[200001];
int extgcd(int a,int b,int& x,int& y){
int d=a;
if(b != 0){
d = extgcd( b , a%b, y, x);
y -= (a/b)*x;
} else{
x=1; y=0;
}
return d;
}
int mod_inverse(int a,int m){
int x,y;
extgcd(a,m,x,y);
return (m+x%m) %m;
}
ll comb(ll n,ll r){
return (((jo[n]*mod_inverse(jo[r],mod)) %mod) *mod_inverse(jo[n-r],mod))%mod;
}
ss main()
{
cin>>N;
jo[0]=jo[1]=1LL;
rep1(i,2*N){
jo[i]= (jo[i-1]*i) %mod;
}
rep(i,N){
cin>>A[i];
xs.pb(A[i]);
}
rep(i,N){
cin>>B[i];
xs.pb(B[i]);
}
sort(xs.begin(),xs.end());
xs.erase( unique(xs.begin(),xs.end()) , xs.end() );
rep(i,N){
A[i] = lower_bound(xs.begin(),xs.end(),A[i]) - xs.begin();
B[i] = lower_bound(xs.begin(),xs.end(),B[i]) - xs.begin();
w[A[i]]=0;
w[B[i]]=1;
}
ll cnt;
for(int i = 0; i< 2*N ;i++){
cnt = 1LL;
while(i + 1 < 2*N && w[i] == w[i+1] ){
i++;
cnt++;
}
F.pb(cnt);
}
ll ans = 1LL;
rep(i,F.size()-1){
if( F[i] <= F[i+1] ){
ans = (ans * jo[F[i]])%mod;
F[i+1]-=F[i];
}
else{
ans = (((ans * jo[F[i+1]])%mod)*comb(F[i],F[i+1]))%mod;
F[i+2] += (F[i]-F[i+1]);
F[i] = F[i+1] = 0;
}
}
cout<<ans<<endl;
}
| a.cc:58:1: error: '::main' must return 'int'
58 | ss main()
| ^~
|
s374171882 | p03878 | C++ | #include <bits/stdc++.h>
#include <boost/functional/hash.hpp>
#define debug 0
#define esc(ret) cout << (ret) << endl,quick_exit(0)
#define fcout(d) cout << fixed << setprecision(d)
#define repU(i,s,t) for(int i = (int)(s); i <= (int)(t); ++i)
#define repD(i,s,t) for(int i = (int)(s); i >= (int)(t); --i)
#define rep(i,n) repU(i,0,(n) - 1)
#define rep1(i,n) repU(i,1,(n))
#define all(v) begin(v),end(v)
#define vct vector
#define prique priority_queue
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define ins insert
#define emp emplace
#define era erase
#define fir first
#define sec second
#define odd(x) (x & 1)
#define even(x) (!odd(x))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<db,int> pdi;
typedef tuple<int,int,int> tiii;
const int dir[][2] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int mod = 1e9 + 7;
const int inf32 = (1 << 30) - 1;
const ll inf64 = (1LL << 62) - 1;
template <class T, class U> T qceil(T x, U y) { return x > 0 ? (x - 1) / y + 1 : x / y; }
template <class T, class U> bool parity(T x, U y) { return odd(x) ^ even(y); }
template <class T, class U> bool chmax(T &m, U x) { if(m < x) { m = x; return 1; } return 0; }
template <class T, class U> bool chmin(T &m, U x) { if(m > x) { m = x; return 1; } return 0; }
template <class T> bool cmprs(T &v) {
T tmp = v;
sort(all(tmp));
tmp.erase(unique(all(tmp)),end(tmp));
for(auto it = begin(v); it != end(v); ++it) *it = l_bnd(all(tmp),*it) - begin(tmp) + 1;
return v.size() > tmp.size();
}
struct Table {
ll md;
vct<ll> fact_tbl,invfact_tbl;
vct<vct<ll>> comb_tbl;
Table(int n, ll m = mod) {
md = m;
fact_init(n);
invfact_init(n);
//comb_init(n);
}
ll fact(int x) {
return fact_tbl[x];
}
ll invfact(int x) {
return invfact_tbl[x];
}
ll comb(int x, int y) {
if(x < y || y < 0) return 0;
return comb_tbl[x][y];
}
void fact_init(int n) {
fact_tbl.resize(n + 1);
fact_tbl[0] = 1;
rep1(i,n) fact_tbl[i] = fact_tbl[i - 1] * i % md;
}
void invfact_init(int n) {
invfact_tbl.resize(n + 1);
rep(i,n + 1) invfact_tbl[i] = modinv(fact(i));
}
void comb_init(int n) {
comb_tbl.resize(n + 1);
comb_tbl[0].assign(1,1);
rep1(i,n) {
comb_tbl[i].resize(i + 1);
rep(j,i/2 + 1) {
comb_tbl[i][j] = comb_tbl[i][i - j] = (comb(i - 1,j - 1) + comb(i - 1,j)) % md;
}
}
}
ll modpow(ll n, ll e) {
n %= md,e %= md - 1;
ll ret = 1;
while(e) {
if(e & 1) ret = ret * n % md;
n = n * n % md;
e /= 2;
}
return ret;
}
ll modinv(ll n) {
return modpow(n,md - 2);
}
};
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n,a[100100],b[100100];
cin>>n;
rep(i,n)cin>>a[i];
rep(i,n)cin>>b[i];
sort(a,a+n);
sort(b,b+n);
ll ans = 1;
int l[100010],r[100010];
for(int i=0,j=n-1;i<n;i++,j--){
l[i]=i?l[i-1]:0;
r[i]=i?r[i-1]:0:
while(l[i]<n&&b[l[i]]<a[i]) ++l[i];
while(r[i]<n&&a[r[i]]<b[i]) ++r[i];
}
for(int i=0;i<n;i++,ans%=mod){
int j=max(i,l[i]);
int k=max(i,r[i]);
ans*=k+j-2*i;
}
esc(ans);
}
| a.cc:2:10: fatal error: boost/functional/hash.hpp: No such file or directory
2 | #include <boost/functional/hash.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s890697244 | p03878 | C++ | #include <bits/stdc++.h>
#include <boost/functional/hash.hpp>
#define debug 0
#define esc(ret) cout << (ret) << endl,quick_exit(0)
#define fcout(d) cout << fixed << setprecision(d)
#define repU(i,s,t) for(int i = (int)(s); i <= (int)(t); ++i)
#define repD(i,s,t) for(int i = (int)(s); i >= (int)(t); --i)
#define rep(i,n) repU(i,0,(n) - 1)
#define rep1(i,n) repU(i,1,(n))
#define all(v) begin(v),end(v)
#define vct vector
#define prique priority_queue
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define ins insert
#define emp emplace
#define era erase
#define fir first
#define sec second
#define odd(x) (x & 1)
#define even(x) (!odd(x))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef pair<int,int> pii;
typedef pair<db,int> pdi;
typedef tuple<int,int,int> tiii;
const int dir[][2] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int mod = 1e9 + 7;
const int inf32 = (1 << 30) - 1;
const ll inf64 = (1LL << 62) - 1;
template <class T, class U> T qceil(T x, U y) { return x > 0 ? (x - 1) / y + 1 : x / y; }
template <class T, class U> bool parity(T x, U y) { return odd(x) ^ even(y); }
template <class T, class U> bool chmax(T &m, U x) { if(m < x) { m = x; return 1; } return 0; }
template <class T, class U> bool chmin(T &m, U x) { if(m > x) { m = x; return 1; } return 0; }
template <class T> bool cmprs(T &v) {
T tmp = v;
sort(all(tmp));
tmp.erase(unique(all(tmp)),end(tmp));
for(auto it = begin(v); it != end(v); ++it) *it = l_bnd(all(tmp),*it) - begin(tmp) + 1;
return v.size() > tmp.size();
}
struct Table {
ll md;
vector<ll> fact_tbl,invfact_tbl;
vector<vector<ll>> comb_tbl;
Table(int n, int m = mod) {
md = m;
fact_init(n);
invfact_init(n);
//comb_init(n);
}
ll fact(int x) {
return fact_tbl[x];
}
ll invfact(int x) {
return invfact_tbl[x];
}
ll comb(int x, int y) {
if(x < y || y < 0) return 0;
return comb_tbl[x][y];
}
void fact_init(int n) {
fact_tbl.resize(n + 1);
fact_tbl[0] = 1;
for(int i = 1; i <= n; i++) fact_tbl[i] = fact_tbl[i - 1] * i % md;
}
void invfact_init(int n) {
invfact_tbl.resize(n + 1);
for(int i = 0; i <= n; i++) invfact_tbl[i] = modinv(fact(i));
}
void comb_init(int n) {
comb_tbl.resize(n + 1);
comb_tbl[0].assign(1,1);
for(int i = 1; i <= n; i++) {
comb_tbl[i].resize(i + 1);
for(int j = 0; j * 2 <= i; j++) {
comb_tbl[i][j] = comb_tbl[i][i - j] = (comb(i - 1,j - 1) + comb(i - 1,j)) % md;
}
}
}
ll modpow(ll n, ll e) {
n %= md,e %= md - 1;
ll ret = 1;
while(e) {
if(e & 1) ret = ret * n % md;
n = n * n % md;
e /= 2;
}
return ret;
}
ll modinv(ll n) {
return modpow(n,md - 2);
}
};
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n,a[100100],b[100100];
cin>>n;
Table tb(n);
rep(i,n)cin>>a[i];
rep(i,n)cin>>b[i];
sort(a,a+n);
sort(b,b+n);
a[n]=inf32;
ll ans = 1;
while(i<n){
int j=i;
while(j<n&&a[i]>b[j])++j;
if(j>i){
ans*=j-i;
ans%=mod;
i=j;
continue;
}
int k=i;
while(k<n&&a[k]<b[i])++k;
ans*=k-i;
ans%=mod;
i=k;
}
esc(ans);
}
| a.cc:2:10: fatal error: boost/functional/hash.hpp: No such file or directory
2 | #include <boost/functional/hash.hpp>
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
|
s358133749 | p03878 | C++ | #include <iostream>
using namespace std;
#include <list>
#include <stack>
#define ll long long
//00p0d0dp0p0d
int main(){
int n;
cin >>n;
int a[n];
int b[n];
list<int> vacant;
int ans=0;
ll codelen=9223372036854775807;
for(int i=0;i<n;i++){
cin >> a[i];
}
sort(a,a+n);
for(int i=0;i<n;i++){
cin >> b[i];
// vacant.push_back(b[i]);
}
sort(b,b+n);
int curlen=0;
for(int i=0;i<n;i++){
curlen+=abs(a[i]-b[i]);
}
ans=1;
int another[n];
for(int i=0;i<n-1; i++){
int x=abs(a[i]-b[i])+abs(a[i+1]-b[i+1]);
int y=abs(a[i]-b[i+1])+abs(a[i+1]-b[i]);
if (x==y){
ans*=2;
}
}
cout <<ans<<endl;
// cout <<ans<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:19:5: error: 'sort' was not declared in this scope; did you mean 'short'?
19 | sort(a,a+n);
| ^~~~
| short
|
s911223538 | p03878 | C++ | #include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部0にする
vector<int> G[100005];
std::vector<P> tree[100010];
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
ll i,j,k,l,ii,jj;
ll n,m;
ll a[100005],b[100005];
bool x[200005];
ll num=0
ll ans=1;
bool flag=false;
int maint(){
for(i=0;i<=1000000000;i++){
ans+=i;
ans%=mod;
}
cout<<ans<<endl;
return 0;
}
| a.cc:33:1: error: expected ',' or ';' before 'll'
33 | ll ans=1;
| ^~
a.cc: In function 'int maint()':
a.cc:38:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
38 | ans+=i;
| ^~~
| abs
a.cc:41:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
41 | cout<<ans<<endl;
| ^~~
| abs
|
s701936170 | p03878 | C++ | #include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部0にする
vector<int> G[100005];
std::vector<P> tree[100010];
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
ll i,j,k,l,ii,jj;
ll n,m;
ll a[100005],b[100005];
bool x[200005];
ll num=0
ll ans=1;
bool flag=false;
int maint(){
for(i=0;i<=1000000000;i++){
ans+=i;
ans%-mod;
}
cout<<ans<<endl;
return 0;
}
| a.cc:33:1: error: expected ',' or ';' before 'll'
33 | ll ans=1;
| ^~
a.cc: In function 'int maint()':
a.cc:38:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
38 | ans+=i;
| ^~~
| abs
a.cc:41:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
41 | cout<<ans<<endl;
| ^~~
| abs
|
s768378108 | p03878 | C | #include<stdio.h>
#include<stdlib.h>
int R=1,C=1,H[2000010],N[2000010];
//評価関数(いまはMAX)
int hyouka(int a,int b){
if(C<b)return 1;
if(C<a||b==0)return 0;
return N[H[a]]>N[H[b]]?1:0;
}
//挿入関数
void hin(int a){
int i=C++;
for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
H[i]=R++;
}
//取り出す関数
int hout(){
int rt=H[1],i,j=2,k=H[--C];
for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
H[j/2]=k;
return rt;
}
int main(){
int n,i,a,b=0,M=1e9;
long long s=1,c=1;
scanf("%d",&n);
for(i=0;i<n*2;i++){
scanf("%d",&a);
hin(a);
}
for(i=0;i<n*2;i++){
hout()<=n?(b++):(b--);//printf("%d\n",b);
if(b)s=(s*abs(b))%M;
}
printf("%lld\n",s);
return 0;
}
#include<stdio.h>
#include<stdlib.h>
int R=1,C=1,H[2000010],N[2000010];
//評価関数(いまはMAX)
int hyouka(int a,int b){
if(C<b)return 1;
if(C<a||b==0)return 0;
return N[H[a]]>N[H[b]]?1:0;
}
//挿入関数
void hin(int a){
int i=C++;
for(N[H[0]=R]=a;hyouka(0,i/2);i/=2)H[i]=H[i/2];
H[i]=R++;
}
//取り出す関数
int hout(){
int rt=H[1],i,j=2,k=H[--C];
for(i=1;hyouka(i,C);i=j)H[i]=H[j=i*2+1-hyouka(i*2,i*2+1)];
H[j/2]=k;
return rt;
}
int main(){
int n,i,a,b=0,M=1e9+7;
long long s=1;
scanf("%d",&n);
for(i=0;i<n*2;i++){
scanf("%d",&a);
hin(a);
}
for(i=0;i<n*2;i++){
hout()<=n?(b++):(b--);//printf("%d\n",b);
if(b)s=(s*abs(b))%M;
}
printf("%lld\n",s);
return 0;
}
| main.c:40:5: error: redefinition of 'R'
40 | int R=1,C=1,H[2000010],N[2000010];
| ^
main.c:3:5: note: previous definition of 'R' with type 'int'
3 | int R=1,C=1,H[2000010],N[2000010];
| ^
main.c:40:9: error: redefinition of 'C'
40 | int R=1,C=1,H[2000010],N[2000010];
| ^
main.c:3:9: note: previous definition of 'C' with type 'int'
3 | int R=1,C=1,H[2000010],N[2000010];
| ^
main.c:42:5: error: redefinition of 'hyouka'
42 | int hyouka(int a,int b){
| ^~~~~~
main.c:5:5: note: previous definition of 'hyouka' with type 'int(int, int)'
5 | int hyouka(int a,int b){
| ^~~~~~
main.c:48:6: error: redefinition of 'hin'
48 | void hin(int a){
| ^~~
main.c:11:6: note: previous definition of 'hin' with type 'void(int)'
11 | void hin(int a){
| ^~~
main.c:54:5: error: redefinition of 'hout'
54 | int hout(){
| ^~~~
main.c:17:5: note: previous definition of 'hout' with type 'int()'
17 | int hout(){
| ^~~~
main.c:60:5: error: redefinition of 'main'
60 | int main(){
| ^~~~
main.c:23:5: note: previous definition of 'main' with type 'int()'
23 | int main(){
| ^~~~
|
s697856855 | p03878 | C++ | int a[101010], b[101010];
vector<pair<int, int>>v;
const int MOD = 1e9 + 7;
int main(){
int n;
cin >> n;
for (int i = 0; i < n; i++) cin >> a[i], v.emplace_back(a[i], 1);
for (int i = 0; i < n; i++) cin >> b[i], v.emplace_back(b[i], 2);
sort(ALL(v));
LL ans = 1;
int pa = 0, pb = 0;
for (int i = 0; i < 2 * n; i++) {
if (v[i].second == 1) {
if (pb == 0)pa++;
else (ans *= pb) %= MOD,pb--;
}
if (v[i].second == 2) {
if (pa == 0)pb++;
else (ans *= pa) %= MOD,pa--;
}
}
cout << ans%MOD << endl;
} | a.cc:2:1: error: 'vector' does not name a type
2 | vector<pair<int, int>>v;
| ^~~~~~
a.cc: In function 'int main()':
a.cc:7:9: error: 'cin' was not declared in this scope
7 | cin >> n;
| ^~~
a.cc:8:50: error: 'v' was not declared in this scope
8 | for (int i = 0; i < n; i++) cin >> a[i], v.emplace_back(a[i], 1);
| ^
a.cc:9:50: error: 'v' was not declared in this scope
9 | for (int i = 0; i < n; i++) cin >> b[i], v.emplace_back(b[i], 2);
| ^
a.cc:10:18: error: 'v' was not declared in this scope
10 | sort(ALL(v));
| ^
a.cc:10:14: error: 'ALL' was not declared in this scope
10 | sort(ALL(v));
| ^~~
a.cc:10:9: error: 'sort' was not declared in this scope; did you mean 'short'?
10 | sort(ALL(v));
| ^~~~
| short
a.cc:11:9: error: 'LL' was not declared in this scope
11 | LL ans = 1;
| ^~
a.cc:16:31: error: 'ans' was not declared in this scope
16 | else (ans *= pb) %= MOD,pb--;
| ^~~
a.cc:20:31: error: 'ans' was not declared in this scope
20 | else (ans *= pa) %= MOD,pa--;
| ^~~
a.cc:23:9: error: 'cout' was not declared in this scope
23 | cout << ans%MOD << endl;
| ^~~~
a.cc:23:17: error: 'ans' was not declared in this scope
23 | cout << ans%MOD << endl;
| ^~~
a.cc:23:28: error: 'endl' was not declared in this scope
23 | cout << ans%MOD << endl;
| ^~~~
|
s251676954 | p03878 | Java |
import java.util.Arrays;
import java.util.Scanner;
class event implements Comparable<event>{
public int a;
public int b;
public event(int a , int b){
this.a = a;
this.b = b;
}
public int compareTo(event other){
// return b - other.b;
return Integer.compare(b , other.b);
}
}
public class Main{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int N = in.nextInt();
int[] size = new int[2];
event[] vs = new event[2*N];
for (int x=0; x<2; x++)
for (int i=0; i<N; i++)
vs[i+x*N] = new event(x, in.nextInt());
Arrays.sort(vs);
long mod = 1_000_000_007;
long res = 1L;
for (event e : vs)
{
if (size[1 - e.a] > 0){
res *= size[1 - e.a];
res %= mod;
size[1 - e.a]--;
}
else
{
size[p.t]++;
}
}
System.out.println(res);
}
} | Main.java:49: error: cannot find symbol
size[p.t]++;
^
symbol: variable p
location: class Main
1 error
|
s883782135 | p03878 | Java | import java.util.Arrays;
import java.util.Scanner;
class event implements Comparable<event>{
public int a;
public int b;
public event(int a , int b){
this.a = a;
this.b = b;
}
public int compareTo(event other){
// return b - other.b;
return Integer.compare(b , other.b);
}
}
public class A_1D_Matching{
public static void main(String[] args) {
long mod = 10^9+7;
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int size[] = new int[2];
event[] a = new event[2*n];
for (int x=0; x<2; x++)
for (int i=0; i< n; i++)
a[i+x*n] = new event(x, in.nextInt());
Arrays.sort(a);
long res = 1;
for(event e : a){
if(size[1 - e.a] > 0){
res *= size[1 - e.a];
//res %= mod;
size[1 - e.a]--;
}else{
size[e.a]++;
}
}
System.out.println(res);
}
}
| Main.java:19: error: class A_1D_Matching is public, should be declared in a file named A_1D_Matching.java
public class A_1D_Matching{
^
1 error
|
s572124773 | p03878 | Java | package AtCoder_Code_Final_2016;
import java.util.Arrays;
import java.util.Scanner;
class event implements Comparable<event>{
public int a;
public int b;
public event(int a , int b){
this.a = a;
this.b = b;
}
public int compareTo(event other){
// return b - other.b;
return Integer.compare(b , other.b);
}
}
public class A_1D_Matching {
public static void main(String[] args) {
long mod = 10^9+7;
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int size[] = new int[2];
event[] a = new event[2*n];
for (int x=0; x<2; x++)
for (int i=0; i< n; i++)
a[i+x*n] = new event(x, in.nextInt());
Arrays.sort(a);
long res = 1;
for(event e : a){
if(size[1 - e.a] > 0){
res *= size[1 - e.a];
//res %= mod;
size[1 - e.a]--;
}else{
size[e.a]++;
}
}
System.out.println(res);
}
}
| Main.java:21: error: class A_1D_Matching is public, should be declared in a file named A_1D_Matching.java
public class A_1D_Matching {
^
1 error
|
s306047744 | p03878 | Java | package AtCoder_Code_Final_2016;
import java.util.Arrays;
import java.util.Scanner;
class event implements Comparable<event>{
public int a;
public int b;
public event(int a , int b){
this.a = a;
this.b = b;
}
public int compareTo(event other){
// return b - other.b;
return Integer.compare(b , other.b);
}
}
public class A_1D_Matching {
public static void main(String[] args) {
long mod = 10^9+7;
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int size[] = new int[2];
event[] a = new event[2*n];
for (int x=0; x<2; x++)
for (int i=0; i< n; i++)
a[i+x*n] = new event(x, in.nextInt());
Arrays.sort(a);
long res = 1;
for(event e : a){
if(size[1 - e.a] > 0){
res *= size[1 - e.a];
//res %= mod;
size[1 - e.a]--;
}else{
size[e.a]++;
}
}
System.out.println(res);
}
}
| Main.java:21: error: class A_1D_Matching is public, should be declared in a file named A_1D_Matching.java
public class A_1D_Matching {
^
1 error
|
s267032320 | p03878 | Java | import java.util.Arrays;
import java.util.Scanner;
class event implements Comparable<event>{
public int a;
public int b;
public event(int a , int b){
this.a = a;
this.b = b;
}
public int compareTo(event other){
// return b - other.b;
return Integer.compare(b , other.b);
}
}
public class A_1D_Matching {
public static void main(String[] args) {
long mod = 10^9+7;
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int size[] = new int[2];
event[] a = new event[2*n];
for (int x=0; x<2; x++)
for (int i=0; i< n; i++)
a[i+x*n] = new event(x, in.nextInt());
Arrays.sort(a);
long res = 1;
for(event e : a){
if(size[1 - e.a] > 0){
res *= size[1 - e.a];
//res %= mod;
size[1 - e.a]--;
}else{
size[e.a]++;
}
}
System.out.println(res);
}
}
| Main.java:19: error: class A_1D_Matching is public, should be declared in a file named A_1D_Matching.java
public class A_1D_Matching {
^
1 error
|
s043011952 | p03878 | C++ | #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
#include <time.h>
#include <sys/timeb.h>
using namespace std;
int get_time(string r)
{
struct timeb rawtime;
ftime(&rawtime);
static int ms = rawtime.millitm;
static unsigned long s = rawtime.time;
int out_ms = rawtime.millitm - ms;
unsigned long out_s = rawtime.time - s;
if (out_ms < 0)
{
out_ms += 1000;
out_s -= 1;
}
ms = rawtime.millitm;
s = rawtime.time;
int total = 1000*out_s+out_ms;
cout<<r<<": "<<total<<"ms"<<endl;
return total;
}
bool cmp(pair<int, int> a, pair<int, int> b) {
return a.first < b.first;
}
int main(int argc, char *argv[]) {
// get_time("begin");
long beMod = 10e9+7;
int N;
int a, b;
vector<pair<int, int>> all;
cin >> N;
for (int i = 0; i < N; i++)
cin>>a, all.emplace_back(a, 1);
for (int i = 0; i < N; i++)
cin>>b, all.emplace_back(b, -1);
sort(all.begin(), all.end());
vector<long> f(100001); //factorial
f[0] = 1;
for (int i = 1; i <= 100000; i++)
f[i] = (f[i - 1] * i) % beMod;
// for (int i = 0; i < 2 * N; i++) cout<<all[i].first<<endl;
long cnt = 0, res = 1;
for(int i=0;i<all.size();i++){
if(all[i].second==1){
if(cnt < 0) res = res * -cnt % mod;
cnt++;
}
else{
if(cnt > 0) res = res * cnt % mod;
cnt--;
}
}
cout<<res<<endl;
// get_time("end");
return 0;
} | a.cc: In function 'int get_time(std::string)':
a.cc:14:14: warning: 'int ftime(timeb*)' is deprecated: Use gettimeofday or clock_gettime instead [-Wdeprecated-declarations]
14 | ftime(&rawtime);
| ~~~~~^~~~~~~~~~
In file included from a.cc:7:
/usr/include/x86_64-linux-gnu/sys/timeb.h:29:12: note: declared here
29 | extern int ftime (struct timeb *__timebuf)
| ^~~~~
a.cc: In function 'int main(int, char**)':
a.cc:60:56: error: 'mod' was not declared in this scope
60 | if(cnt < 0) res = res * -cnt % mod;
| ^~~
a.cc:64:55: error: 'mod' was not declared in this scope
64 | if(cnt > 0) res = res * cnt % mod;
| ^~~
|
s710842378 | p03878 | C++ | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <iostream>
#include <cassert>
#include <cmath>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <cstdlib>
using namespace std;
#define TASKNAME ""
void solve(int test_number);
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.setf(ios::fixed);
cout.precision(9);
cerr.setf(ios::fixed);
cerr.precision(3);
#ifdef LOCAL
freopen("test.in", "r", stdin);
freopen("test.out", "w", stdout);
#else
#endif
int n = 1;
for (int i = 0; i < n; i++) {
solve(i);
}
}
const int MAX_N = 100005;
const int MOD = 1000000007;
int n, a[MAX_N], b[MAX_N], fact[MAX_N];
void solve(int test_number) {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &a[i]);
}
for (int i = 0; i < n; i++) {
scanf("%d"< &b[i]);
}
sort(a, a + n);
sort(b, b + n);
long long ans = 1;
int var = 0;
int i = 0, j = 0;
while (i < n || j < n) {
if (i == n || (var == 0 && a[i] < b[j])) {
swap(a, b);
swap(i, j);
}
while (j < n && b[j] < a[i]) {
var++;
j++;
}
i++;
ans = ans * var % MOD;
var--;
}
cout << ans << endl;
}
| a.cc: In function 'void solve(int)':
a.cc:50:19: error: comparison between distinct pointer types 'const char*' and 'int*' lacks a cast
50 | scanf("%d"< &b[i]);
| ~~~~^~~~~~~
a.cc:50:19: error: cannot convert 'bool' to 'const char*'
50 | scanf("%d"< &b[i]);
| ~~~~^~~~~~~
| |
| bool
In file included from /usr/include/c++/14/cstdio:42,
from a.cc:1:
/usr/include/stdio.h:428:42: note: initializing argument 1 of 'int scanf(const char*, ...)'
428 | extern int scanf (const char *__restrict __format, ...) __wur;
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
|
s916213916 | p03878 | C++ | int mai(){} | a.cc: In function 'int mai()':
a.cc:1:11: warning: no return statement in function returning non-void [-Wreturn-type]
1 | int mai(){}
| ^
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
|
s058615661 | p03878 | C++ | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
ll a[100001];
ll b[100001];
const int MOD = 1e9 + 7;
ll fact[100001];
ll modpow(ll a, ll b)
{
a %= MOD;
ll r = 1;
while(b)
{
if(b % 2)
{
r = (r*a)%MOD;
}
a = (a*a)%MOD;
b /= 2;
}
if(r < 0) r += MOD;
return r;
}
ll choose(ll n, ll r)
{
if(r == 0)
{
return 1;
}
if(n == r)
{
return 1;
}
ll denom = 1;
for (ll i = 2; i <= r; i++)
{
denom = (denom * i) % MOD;
}
ll res = 1;
for (ll i = n; i > n - r; i--)
{
res = (res * i) % MOD;
}
res = (res * modpow(denom, MOD - 2)) % MOD;
if(res < 0) res += MOD;
return res;
}
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int n; cin>>n;
fact[0]=1;
for(int i = 1; i <= n; i++)
{
fact[i]=(fact[i-1]*i)%MOD;
}
ll sum = 0;
for(int i =0;i<n;i++)
{
cin>>a[i];
sum+=a[i];
}
for(int i=0;i<n;i++)
{
cin>>b[i];
sum-=b[i];
}
if(sum<0) swap(a,b);
sort(a,a+n);
sort(b,b+n);
ll ans = 1;
/*
int ptr = 0;
ll avi = 0;
ll cnt = 0;
for(int i = 0; i < n; i++)
{
while(ptr<n&&b[ptr]<a[i])
{
ptr++;
avi++;
}
if(avi>0)
{
ans=(ans*fact[cnt])%MOD;
avi-=cnt;
cnt=0;
}
if(avi>0)
{
ans=(ans*avi)%MOD;
avi--;
cnt=0;
}
else
{
cnt++;
}
}
ans=(ans*fact[cnt])%MOD;
*/
/*
ll run = 1;
for(int i = 1; i < n; i++)
{
if((a[i]>b[i])==(a[i-1]>b[i-1]))
{
run++;
}
else
{
ans=(ans*fact[run])%MOD;
run = 1;
}
}
*/
vector<ii> vec2;
for(int i = 0; i < n; i++) vec2.pb(mp(a[i],0));
for(int i = 0; i < n; i++) vec2.pb(mp(b[i],1));
sort(vec2.begin(),vec2.end());
ll cur=0;
for(int i = 0; i < 2*n; i++)
{
if(vec[i].se==1) cur++;
else cur--;
ans=(ans*abs(cur))%MOD;
}
cout<<ans<<'\n';
return 0;
vi runs;
int cur = 0;
for(int i = 0; i < 2*n; i++)
{
if(i==0)
{
cur++;
continue;
}
if(vec2[i].se!=vec2[i-1].se)
{
runs.pb(cur);
cur=1;
}
else
{
cur++;
}
}
if(cur>0) runs.pb(cur);
int mode = 0;
int ext = runs[0]; //del when mode = 1
ans = fact[runs[0]];
for(int i = 1; i < runs.size(); i++)
{
mode^=1;
if(mode == 0)
{
if(ext >= 0)
{
ext += runs[i];
//ans=(ans*fact[runs[i]])%MOD;
}
else
{
int be4 = runs[i];
int tmp = min(-ext, runs[i]);
ext+=tmp;
runs[i]-=tmp;
ext += runs[i];
//ans=(ans*fact[runs[i]])%MOD;
//ans = (ans*choose(be4,runs[i]))%MOD;
}
}
else
{
if(ext >= 0)
{
int be4 = runs[i];
int tmp = min(ext, runs[i]);
ext-=tmp;
runs[i]-=tmp;
ext-=runs[i];
//ans=(ans*fact[runs[i]])%MOD;
//ans = (ans*choose(be4,runs[i]))%MOD;
}
else
{
ext-=runs[i];
//ans=(ans*fact[runs[i]])%MOD;
}
}
}
cout<<ans<<'\n';
}
| a.cc: In function 'int main()':
a.cc:149:20: error: 'vec' was not declared in this scope; did you mean 'vec2'?
149 | if(vec[i].se==1) cur++;
| ^~~
| vec2
a.cc:156:13: error: conflicting declaration 'int cur'
156 | int cur = 0;
| ^~~
a.cc:146:12: note: previous declaration as 'll cur'
146 | ll cur=0;
| ^~~
|
s473440232 | p03878 | C++ | #include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int N;
struct node
{
int x;
bool flag;
}arr[200001];
bool cmp(node a,node b)
{
return a.x > b.x;
}
int main()
{
while(~scanf("%d",&N))
{
for(int i=1;i<=N;i++)
{
scanf("%d",&arr[i].x);
arr[i].flag = 0;
}
for(int i=N+1;i<=2*N;i++)
{
scanf("%d",&arr[i].x);
arr[i].flag = 1;
}
sort(arr+1,arr+1+2*N,cmp);
int cnt = 0;
__int64 ans = 1;
for(int i=1;i<=2*N;i++)
{
if(!arr[i].flag)
{
cnt++;
}
else
{
if(cnt != 0)
{
__int64 tmp = 1;
for(int k=1;k<=cnt;k++)
{
tmp *= k;
tmp %= 1000000000 + 7;
}
ans *= tmp;
ans %= 1000000000 + 7;
}
cnt = 0;
}
}
printf("%lld",ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:32:17: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
32 | __int64 ans = 1;
| ^~~~~~~
| __int64_t
a.cc:43:48: error: expected ';' before 'tmp'
43 | __int64 tmp = 1;
| ^~~~
| ;
a.cc:46:49: error: 'tmp' was not declared in this scope; did you mean 'cmp'?
46 | tmp *= k;
| ^~~
| cmp
a.cc:49:41: error: 'ans' was not declared in this scope; did you mean 'abs'?
49 | ans *= tmp;
| ^~~
| abs
a.cc:49:48: error: 'tmp' was not declared in this scope; did you mean 'cmp'?
49 | ans *= tmp;
| ^~~
| cmp
a.cc:55:31: error: 'ans' was not declared in this scope; did you mean 'abs'?
55 | printf("%lld",ans);
| ^~~
| abs
|
s962471304 | p03878 | C++ | #include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int N;
struct node
{
int x;
bool flag;
}arr[200001];
bool cmp(node a,node b)
{
return a.x > b.x;
}
int main()
{
while(~scanf("%d",&N))
{
for(int i=1;i<=N;i++)
{
scanf("%d",&arr[i].x);
arr[i].flag = 0;
}
for(int i=N+1;i<=2*N;i++)
{
scanf("%d",&arr[i].x);
arr[i].flag = 1;
}
sort(arr+1,arr+1+2*N,cmp);
int cnt = 0;
__int64 ans = 1;
for(int i=1;i<=2*N;i++)
{
if(!arr[i].flag)
{
cnt++;
}
else
{
if(cnt != 0)
{
__int64 tmp = 1;
for(int k=1;k<=cnt;k++)
{
tmp *= k;
tmp %= 1000000000 + 7;
}
ans *= tmp;
ans %= 1000000000 + 7;
}
cnt = 0;
}
}
printf("%lld",ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:32:17: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
32 | __int64 ans = 1;
| ^~~~~~~
| __int64_t
a.cc:43:48: error: expected ';' before 'tmp'
43 | __int64 tmp = 1;
| ^~~~
| ;
a.cc:46:49: error: 'tmp' was not declared in this scope; did you mean 'cmp'?
46 | tmp *= k;
| ^~~
| cmp
a.cc:49:41: error: 'ans' was not declared in this scope; did you mean 'abs'?
49 | ans *= tmp;
| ^~~
| abs
a.cc:49:48: error: 'tmp' was not declared in this scope; did you mean 'cmp'?
49 | ans *= tmp;
| ^~~
| cmp
a.cc:55:31: error: 'ans' was not declared in this scope; did you mean 'abs'?
55 | printf("%lld",ans);
| ^~~
| abs
|
s475740297 | p03878 | C++ | #include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int N;
struct node
{
int x;
bool flag;
}arr[200001];
bool cmp(node a,node b)
{
return a.x > b.x;
}
int main()
{
while(~scanf("%d",&N))
{
for(int i=1;i<=N;i++)
{
scanf("%d",&arr[i]);
arr[i].flag = 0;
}
for(int i=N+1;i<=2*N;i++)
{
scanf("%d",&arr[i]);
arr[i].flag = 1;
}
sort(arr+1,arr+1+2*N,cmp);
int cnt = 0;
__int64 ans = 1;
for(int i=1;i<=2*N;i++)
{
if(!arr[i].flag)
{
cnt++;
}
else
{
if(cnt != 0)
{
__int64 tmp = 1;
for(int k=1;k<=cnt;k++)
{
tmp *= k;
tmp %= 1000000000 + 7;
}
ans *= tmp;
ans %= 1000000000 + 7;
}
cnt = 0;
}
}
printf("%lld",ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:32:17: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
32 | __int64 ans = 1;
| ^~~~~~~
| __int64_t
a.cc:43:48: error: expected ';' before 'tmp'
43 | __int64 tmp = 1;
| ^~~~
| ;
a.cc:46:49: error: 'tmp' was not declared in this scope; did you mean 'cmp'?
46 | tmp *= k;
| ^~~
| cmp
a.cc:49:41: error: 'ans' was not declared in this scope; did you mean 'abs'?
49 | ans *= tmp;
| ^~~
| abs
a.cc:49:48: error: 'tmp' was not declared in this scope; did you mean 'cmp'?
49 | ans *= tmp;
| ^~~
| cmp
a.cc:55:31: error: 'ans' was not declared in this scope; did you mean 'abs'?
55 | printf("%lld",ans);
| ^~~
| abs
|
s444130127 | p03878 | C++ | #include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int N;
struct node
{
int x;
bool flag;
}arr[200001];
bool cmp(node a,node b)
{
return a.x > b.x;
}
int main()
{
while(~scanf("%d",&N))
{
for(int i=1;i<=N;i++)
{
scanf("%d",&arr[i]);
arr[i].flag = 0;
}
for(int i=N+1;i<=2*N;i++)
{
scanf("%d",&arr[i]);
arr[i].flag = 1;
}
sort(arr+1,arr+1+2*N,cmp);
int cnt = 0;
__int64 ans = 1;
for(int i=1;i<=2*N;i++)
{
if(!arr[i].flag)
{
cnt++;
}
else
{
if(cnt != 0)
{
__int64 tmp = 1;
for(int k=1;k<=cnt;k++)
{
tmp *= k;
tmp %= 1000000000 + 7;
}
ans *= tmp;
ans %= 1000000000 + 7;
}
cnt = 0;
}
}
printf("%lld",ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:32:17: error: '__int64' was not declared in this scope; did you mean '__int64_t'?
32 | __int64 ans = 1;
| ^~~~~~~
| __int64_t
a.cc:43:48: error: expected ';' before 'tmp'
43 | __int64 tmp = 1;
| ^~~~
| ;
a.cc:46:49: error: 'tmp' was not declared in this scope; did you mean 'cmp'?
46 | tmp *= k;
| ^~~
| cmp
a.cc:49:41: error: 'ans' was not declared in this scope; did you mean 'abs'?
49 | ans *= tmp;
| ^~~
| abs
a.cc:49:48: error: 'tmp' was not declared in this scope; did you mean 'cmp'?
49 | ans *= tmp;
| ^~~
| cmp
a.cc:55:31: error: 'ans' was not declared in this scope; did you mean 'abs'?
55 | printf("%lld",ans);
| ^~~
| abs
|
s762181923 | p03878 | C++ | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int main() {
int n; cin >> n;
vector<int> a(n, 0), b(n, 0);
for(int i = 0; i < n; ++i)
cin >> a[i];
for(int i = 0; i < n; ++i)
cin >> b[i];
sort(a.begin(), a.end());
sort(b.begin(), b.end());
int ans = 1;
set<int> s;
for(int i = 0; i < n; ++i)
s.insert(b[i]);
auto many = [&] (int x, int y) {
auto lf = lower_bound(a.begin(), a.end(), x);
if(lf == a.end())
return 0;
auto rt = upper_bound(a.begin(), a.end(), y);
rt--;
return (rt - lf + 1);
};
for(int i = 0; i < n; ++i) {
int x = *(s.begin());
s.erase(s.begin());
ans = 1LL * ans * (many(min(x, a[i]), max(x, a[i]))) % MOD;
}
cout << ans << "\n";
} | a.cc: In lambda function:
a.cc:30:25: error: inconsistent types 'int' and 'long int' deduced for lambda return type
30 | return (rt - lf + 1);
| ~~~~~~~~~^~~~
|
s205957250 | p03878 | C++ | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
TaskA solver = new TaskA();
solver.solve(1, in, out);
out.close();
}
static class TaskA {
public int mod = 1000000007;
public void solve(int testNumber, InputReader in, PrintWriter out) {
int n = in.nextInt();
TaskA.Event[] evs = new TaskA.Event[2 * n];
for (int i = 0; i < n; i++) {
evs[i] = new TaskA.Event(in.nextInt(), +1);
}
for (int i = 0; i < n; i++) {
evs[i + n] = new TaskA.Event(in.nextInt(), -1);
}
Arrays.sort(evs);
int curcount = 0;
long nways = 1;
for (int i = 0; i < 2 * n; i++) {
if (evs[i].b == +1) {
if (curcount < 0) {
nways = nways * (-curcount) % mod;
}
curcount++;
} else {
if (curcount > 0) {
nways = nways * curcount % mod;
}
curcount--;
}
}
out.println(nways);
}
static class Event implements Comparable<TaskA.Event> {
public int a;
public int b;
public Event(int a, int b) {
this.a = a;
this.b = b;
}
public int compareTo(TaskA.Event other) {
return a - other.a;
}
}
}
static class InputReader {
public BufferedReader reader;
public StringTokenizer tokenizer;
public InputReader(InputStream stream) {
reader = new BufferedReader(new InputStreamReader(stream), 32768);
tokenizer = null;
}
public String next() {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
try {
tokenizer = new StringTokenizer(reader.readLine());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return tokenizer.nextToken();
}
public int nextInt() {
return Integer.parseInt(next());
}
}
}
| a.cc:1:1: error: 'import' does not name a type
1 | import java.io.OutputStream;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.io.IOException;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import java.io.InputStream;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
4 | import java.io.PrintWriter;
| ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:5:1: error: 'import' does not name a type
5 | import java.util.Arrays;
| ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
6 | import java.util.StringTokenizer;
| ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
7 | import java.io.IOException;
| ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: 'import' does not name a type
8 | import java.io.BufferedReader;
| ^~~~~~
a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:9:1: error: 'import' does not name a type
9 | import java.io.InputStreamReader;
| ^~~~~~
a.cc:9:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:10:1: error: 'import' does not name a type
10 | import java.io.InputStream;
| ^~~~~~
a.cc:10:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:16:1: error: expected unqualified-id before 'public'
16 | public class Main {
| ^~~~~~
|
s070661480 | p03879 | C++ | # cf16-exhibition-final-openB - Inscribed Bicycle
def main():
x1, y1, x2, y2, x3, y3 = map(int, open(0).read().split())
x2 -= x1
y2 -= y1
x3 -= x1
y3 -= y1
a = ((x2 - x3) ** 2 + (y2 - y3) ** 2) ** 0.5
b = (x3 ** 2 + y3 ** 2) ** 0.5
c = (x2 ** 2 + y2 ** 2) ** 0.5
r = abs(x2 * y3 - x3 * y2) / (a + b + c)
d = max(a, b, c)
ans = r * d / (2 * r + d)
print(ans)
if __name__ == "__main__":
main()
| a.cc:1:3: error: invalid preprocessing directive #cf16
1 | # cf16-exhibition-final-openB - Inscribed Bicycle
| ^~~~
a.cc:2:1: error: 'def' does not name a type
2 | def main():
| ^~~
|
s367923228 | p03879 | C++ | #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
double x[3], y[3];
for(int i = 0; i < 3; i++) cin >> x[i] >> y[i];
double a, b, c;
a = sqrt(pow(x[0]-x[1], 2)+pow(y[0]-y[1], 2));
b = sqrt(pow(x[1]-x[2], 2)+pow(y[1]-y[2], 2));
c = sqrt(pow(x[2]-x[0], 2)+pow(y[2]-y[0], 2));
double s = (a+b+c) / 2;
double S = sqrt(s*(s-a)*(s-b)*(s-c));
double maxL = max({a, b, c});
double h = 2*S/maxL;
double r = S/(s+h);
cout << setprecision(12);
cout << r << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:15:20: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
15 | double maxL = max({a, b, c});
| ~~~^~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided
|
s061408854 | p03879 | C++ | #include <bits/stdc++.h>
using ll = long long;
#define int ll
namespace ext {
template <class T>
struct vec_type;
template <class T>
constexpr bool is_vec_v;
using namespace std;
template<class T>
struct Vector : std::vector<T> {
using std::vector<T>::vector;
char dil = ' ';
Vector<T> accum() {
Vector<T> res(this->size() + 1);
for (size_t i = 0; i < this->size(); i++) {
res[i+1] = (*this)[i] + res[i];
}
return res;
}
template<class U = T>
typename enable_if<is_vec_v<U>, Vector<T>>::type accum2D() {
const size_t H = this->size();
const size_t W = (*this)[0].size();
using S = typename vec_type<U>::type;
Vector<T> res(H + 1, Vector<S>(W + 1));
for (size_t i = 0; i < H; i++) {
for (size_t j = 0; j < W; j++) {
res[i+1][j+1] = (*this)[i][j];
res[i+1][j+1] += res[i][j+1];
res[i+1][j+1] += res[i+1][j];
res[i+1][j+1] -= res[i][j];
}
}
return res;
}
Vector<T> zaatsu() {
map<T, int> m;
for (auto& e: *this) m[e] = 1;
int count = 0;
for (auto& e: m) e.second = count++;
Vector<T> res = *this;
for (auto& e: res) e = m[e];
return res;
}
friend istream& operator>>(istream& is, Vector<T>& t) {
for (auto& e: t) cin >> e;
return is;
}
friend ostream& operator<<(ostream& os, Vector<T>& t) {
t.print(' ', os);
return os;
}
void print(char del = ' ', ostream& os = cout) {
for (size_t i = 0; i < this->size(); i++) {
os << (*this)[i];
if (i + 1 != this->size()) os << del;
os.flush();
}
}
void println(char del = ' ', ostream& os = cout) {
print(del, os);
cout << endl;
}
long long crossinf64xg_merge() {
auto t = *this;
return t.crossinf64xg_merge_sub();
}
// [min_v, max_v)
long long crossinf64xg_bit(T min_v = -1, T max_v = -1) {
if (min_v == -1) min_v = this->min();
if (max_v == -1) max_v = this->max() + 1;
Vector<T> bit(max_v - min_v + 1, 0);
long long res = 0;
for (auto e: *this) {
e = max_v - e;
for (size_t x = e - 1; x; x -= x & -x) {
res += bit[x];
}
for (size_t x = e; x < bit.size() ; x += x & -x) {
bit[x]++;
}
}
return res;
}
bool permutation() {
return next_permutation(this->begin(), this->end());
}
T& max() {
return *max_element(this->begin(), this->end());
}
T& min() {
return *min_element(this->begin(), this->end());
}
private:
long long crossinf64xg_merge_sub() {
if (this->size() == 1) return 0;
int x = this->size() / 2;
Vector<T> left(this->begin(), this->begin() + x);
Vector<T> right(this->begin() + x, this->end());
long long res = left.crossinf64xg_merge_sub() + right.crossing_merge_sub();
left.push_back(numeric_limits<T>::max()); right.push_back(numeric_limits<T>::max());
size_t l = 0, r = 0;
while (l + r < this->size()) {
if (left[l] < right[r]) {
(*this)[l+r] = left[l];
l++;
} else {
(*this)[l+r] = right[r];
r++;
res += x - l;
}
}
return res;
}
};
template <class T>
struct vec_type : std::false_type {};
template <class T>
struct vec_type<Vector<T>> : std::true_type {
using type = T;
};
template <class T>
constexpr bool is_vec_v = vec_type<T>::value;
}
// [a -> b-1]
#define reps(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
// [0 -> a-1]
#define rep(i, a) reps(i, 0, (a))
// [a-1 -> b]
#define rreps(i, a, b) for (int i = (int)((a)-1); i >= (int)(b); i--)
// [a-1 -> 0]
#define rrep(i, a) rreps(i, a, 0)
#define all(v) (v).begin(), (v).end()
// next_permutation(all(v))
#define PERM(v) next_permutation(all(v))
/*sort(all(v));
* (v).erase(unique(all(v)), v.end())*/
#define UNIQUE(v)\
sort(all(v));\
(v).erase(unique(all(v)), v.end())
#define MINV(v) min_element(all(v))
#define MAXV(v) max_element(all(v))
#define MIN3(a, b, c) min(min(a, b), c)
#define MIN4(a, b, c, d) min(MIN3(a, b, c), d)
#define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e)
#define MIN6(a, b, c, d, e, f) min(MIN5(a, b, c, d, e), f)
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(MAX3(a, b, c), d)
#define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e)
#define MAX6(a, b, c, d, e, f) max(MAX5(a, b, c, d, e), f)
// b is [a, c)
#define RANGE(a, b, c) ((a) <= (b) && (b) < (c))
// c is [a, e) && d is [b, f)
#define RANGE2D(a, b, c, d, e, f) (RANGE((a), (c), (e)) && RANGE((b), (d), (f)))
#define chmin(a, b) a = min(a, (b))
#define chmin3(a, b, c) a = MIN3(a, (b), (c))
#define chmin4(a, b, c, d) a = MIN4(a, (b), (c), (d))
#define chmin5(a, b, c, d, e) a = MIN5(a, (b), (c), (d), (e))
#define chmin6(a, b, c, d, e, f) a = MIN6(a, (b), (c), (d), (e), (f))
#define chmax(a, b) a = max(a, (b))
#define chmax3(a, b, c) a = MAX3(a, (b), (c))
#define chmax4(a, b, c, d) a = MAX4(a, (b), (c), (d))
#define chmax5(a, b, c, d, e) a = MAX5(a, (b), (c), (d), (e))
#define chmax6(a, b, c, d, e, f) a = MAX6(a, (b), (c), (d), (e), (f))
#define fcout cout << fixed << setprecision(15)
#define YES(f) cout << ((f) ? YES_STR : NO_STR) << endl;
using namespace std;
using namespace ext;
constexpr long double pi = 3.1415926535897932384626433832795;
#define RAD(x) (x * 180 / pi)
long double x[3];
long double y[3];
long double uvx[3];
long double uvy[3];
long double deg[3];
long double L[3];
long double R;
// meguru<T>(ok, ng, isok)で呼ぶ
template<class T>
T meguru(T ok, T ng, function<bool(T)> isok) {
while (abs(ok - ng) > 1e-15) {
T mid = (ok + ng) / 2;
(isok(mid) ? ok : ng) = mid;
}
return ok;
}
long double dist(long double xa, long double ya, long double xb, long double yb) {
long double dx = xa - xb;
long double dy = ya - yb;
return sqrtf64x(dx * dx + dy * dy);
}
signed main() {
rep(i, 3) cin >> x[i] >> y[i];
L[0] = dist(x[1], y[1], x[2], y[2]);
L[1] = dist(x[0], y[0], x[2], y[2]);
L[2] = dist(x[0], y[0], x[1], y[1]);
{
long double xa = x[1] - x[0], ya = y[1] - y[0];
long double xb = x[2] - x[0], yb = y[2] - y[0];
long double S = abs(xa * yb - xb * ya) / 2;
R = 2 * S / (L[0] + L[1] + L[2]);
}
double maxL = *max_element(L, L+3);
fcout << meguru<double>(0, 1000, [&](double mid) -> bool {
return maxL * (1 - mid / R) > 2 * mid;
}) << endl;
}
| a.cc:126:24: error: redefinition of 'template<class T> constexpr const bool ext::is_vec_v'
126 | constexpr bool is_vec_v = vec_type<T>::value;
| ^~~~~~~~
a.cc:10:24: note: 'template<class T> constexpr const bool ext::is_vec_v<T>' previously declared here
10 | constexpr bool is_vec_v;
| ^~~~~~~~
|
s723564845 | p03879 | C++ | #include <bits/stdc++.h>
using ll = long long;
#define int ll
namespace ext {
template <class T>
struct vec_type;
template <class T>
constexpr bool is_vec_v;
using namespace std;
template<class T>
struct Vector : std::vector<T> {
using std::vector<T>::vector;
char dil = ' ';
Vector<T> accum() {
Vector<T> res(this->size() + 1);
for (size_t i = 0; i < this->size(); i++) {
res[i+1] = (*this)[i] + res[i];
}
return res;
}
template<class U = T>
typename enable_if<is_vec_v<U>, Vector<T>>::type accum2D() {
const size_t H = this->size();
const size_t W = (*this)[0].size();
using S = typename vec_type<U>::type;
Vector<T> res(H + 1, Vector<S>(W + 1));
for (size_t i = 0; i < H; i++) {
for (size_t j = 0; j < W; j++) {
res[i+1][j+1] = (*this)[i][j];
res[i+1][j+1] += res[i][j+1];
res[i+1][j+1] += res[i+1][j];
res[i+1][j+1] -= res[i][j];
}
}
return res;
}
Vector<T> zaatsu() {
map<T, int> m;
for (auto& e: *this) m[e] = 1;
int count = 0;
for (auto& e: m) e.second = count++;
Vector<T> res = *this;
for (auto& e: res) e = m[e];
return res;
}
friend istream& operator>>(istream& is, Vector<T>& t) {
for (auto& e: t) cin >> e;
return is;
}
friend ostream& operator<<(ostream& os, Vector<T>& t) {
t.print(' ', os);
return os;
}
void print(char del = ' ', ostream& os = cout) {
for (size_t i = 0; i < this->size(); i++) {
os << (*this)[i];
if (i + 1 != this->size()) os << del;
os.flush();
}
}
void println(char del = ' ', ostream& os = cout) {
print(del, os);
cout << endl;
}
long long crossinf64xg_merge() {
auto t = *this;
return t.crossinf64xg_merge_sub();
}
// [min_v, max_v)
long long crossinf64xg_bit(T min_v = -1, T max_v = -1) {
if (min_v == -1) min_v = this->min();
if (max_v == -1) max_v = this->max() + 1;
Vector<T> bit(max_v - min_v + 1, 0);
long long res = 0;
for (auto e: *this) {
e = max_v - e;
for (size_t x = e - 1; x; x -= x & -x) {
res += bit[x];
}
for (size_t x = e; x < bit.size() ; x += x & -x) {
bit[x]++;
}
}
return res;
}
bool permutation() {
return next_permutation(this->begin(), this->end());
}
T& max() {
return *max_element(this->begin(), this->end());
}
T& min() {
return *min_element(this->begin(), this->end());
}
private:
long long crossinf64xg_merge_sub() {
if (this->size() == 1) return 0;
int x = this->size() / 2;
Vector<T> left(this->begin(), this->begin() + x);
Vector<T> right(this->begin() + x, this->end());
long long res = left.crossinf64xg_merge_sub() + right.crossing_merge_sub();
left.push_back(numeric_limits<T>::max()); right.push_back(numeric_limits<T>::max());
size_t l = 0, r = 0;
while (l + r < this->size()) {
if (left[l] < right[r]) {
(*this)[l+r] = left[l];
l++;
} else {
(*this)[l+r] = right[r];
r++;
res += x - l;
}
}
return res;
}
};
template <class T>
struct vec_type : std::false_type {};
template <class T>
struct vec_type<Vector<T>> : std::true_type {
using type = T;
};
template <class T>
constexpr bool is_vec_v = vec_type<T>::value;
}
// [a -> b-1]
#define reps(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
// [0 -> a-1]
#define rep(i, a) reps(i, 0, (a))
// [a-1 -> b]
#define rreps(i, a, b) for (int i = (int)((a)-1); i >= (int)(b); i--)
// [a-1 -> 0]
#define rrep(i, a) rreps(i, a, 0)
#define all(v) (v).begin(), (v).end()
// next_permutation(all(v))
#define PERM(v) next_permutation(all(v))
/*sort(all(v));
* (v).erase(unique(all(v)), v.end())*/
#define UNIQUE(v)\
sort(all(v));\
(v).erase(unique(all(v)), v.end())
#define MINV(v) min_element(all(v))
#define MAXV(v) max_element(all(v))
#define MIN3(a, b, c) min(min(a, b), c)
#define MIN4(a, b, c, d) min(MIN3(a, b, c), d)
#define MIN5(a, b, c, d, e) min(MIN4(a, b, c, d), e)
#define MIN6(a, b, c, d, e, f) min(MIN5(a, b, c, d, e), f)
#define MAX3(a, b, c) max(max(a, b), c)
#define MAX4(a, b, c, d) max(MAX3(a, b, c), d)
#define MAX5(a, b, c, d, e) max(MAX4(a, b, c, d), e)
#define MAX6(a, b, c, d, e, f) max(MAX5(a, b, c, d, e), f)
// b is [a, c)
#define RANGE(a, b, c) ((a) <= (b) && (b) < (c))
// c is [a, e) && d is [b, f)
#define RANGE2D(a, b, c, d, e, f) (RANGE((a), (c), (e)) && RANGE((b), (d), (f)))
#define chmin(a, b) a = min(a, (b))
#define chmin3(a, b, c) a = MIN3(a, (b), (c))
#define chmin4(a, b, c, d) a = MIN4(a, (b), (c), (d))
#define chmin5(a, b, c, d, e) a = MIN5(a, (b), (c), (d), (e))
#define chmin6(a, b, c, d, e, f) a = MIN6(a, (b), (c), (d), (e), (f))
#define chmax(a, b) a = max(a, (b))
#define chmax3(a, b, c) a = MAX3(a, (b), (c))
#define chmax4(a, b, c, d) a = MAX4(a, (b), (c), (d))
#define chmax5(a, b, c, d, e) a = MAX5(a, (b), (c), (d), (e))
#define chmax6(a, b, c, d, e, f) a = MAX6(a, (b), (c), (d), (e), (f))
#define fcout cout << fixed << setprecision(15)
#define YES(f) cout << ((f) ? YES_STR : NO_STR) << endl;
using namespace std;
using namespace ext;
constexpr long double pi = 3.1415926535897932384626433832795;
#define RAD(x) (x * 180 / pi)
long double x[3];
long double y[3];
long double uvx[3];
long double uvy[3];
long double deg[3];
long double L[3];
long double R;
// meguru<T>(ok, ng, isok)で呼ぶ
template<class T>
T meguru(T ok, T ng, function<bool(T)> isok) {
while (abs(ok - ng) > 1e-15) {
T mid = (ok + ng) / 2;
(isok(mid) ? ok : ng) = mid;
}
return ok;
}
long double dist(long double xa, long double ya, long double xb, long double yb) {
long double dx = xa - xb;
long double dy = ya - yb;
return sqrtf64x(dx * dx + dy * dy);
}
void calc_center(int a, long double r, long double& x_, long double& y_) {
long double l = r / sinf64x(deg[a] / 2);
x_ = x[a] + l * uvx[a];
y_ = y[a] + l * uvy[a];
}
long double solve(int a, int b) {
return meguru<long double>(0, R, [&](long double mid) -> bool {
long double ax, ay; calc_center(a, mid, ax, ay);
long double bx, by; calc_center(b, mid, bx, by);
return dist(ax, ay, bx, by) > 2 * mid;
});
}
signed main() {
rep(i, 3) cin >> x[i] >> y[i];
deg[0] = abs(atan2<long double>(y[1]-y[0], x[1]-x[0]) - atan2(y[2]-y[0], x[2]-x[0]));
deg[1] = abs(atan2<long double>(y[0]-y[1], x[0]-x[1]) - atan2(y[2]-y[1], x[2]-x[1]));
deg[2] = abs(atan2<long double>(y[0]-y[2], x[0]-x[2]) - atan2(y[1]-y[2], x[1]-x[2]));
{long double d = (atan2<long double>(y[1]-y[0], x[1]-x[0]) + atan2(y[2]-y[0], x[2]-x[0])) / 2;
uvx[0] = cosf64x(d); uvy[0] = sinf64x(d);}
{long double d = (atan2<long double>(y[0]-y[1], x[0]-x[1]) + atan2(y[2]-y[1], x[2]-x[1])) / 2;
uvx[1] = cosf64x(d); uvy[1] = sinf64x(d);}
{long double d = (atan2<long double>(y[0]-y[2], x[0]-x[2]) + atan2(y[1]-y[2], x[1]-x[2])) / 2;
uvx[2] = cosf64x(d); uvy[2] = sinf64x(d);}
L[0] = dist(x[1], y[1], x[2], y[2]);
L[1] = dist(x[0], y[0], x[2], y[2]);
L[2] = dist(x[0], y[0], x[1], y[1]);
{
long double xa = x[1] - x[0], ya = y[1] - y[0];
long double xb = x[2] - x[0], yb = y[2] - y[0];
long double S = abs(xa * yb - xb * ya) / 2;
R = 2 * S / (L[0] + L[1] + L[2]);
}
long double res = 0;
rep(i, 2) {
reps(j, i+1, 3) {
chmax(res, solve(i, j));
}
}
fcout << res << endl;
}
| a.cc:126:24: error: redefinition of 'template<class T> constexpr const bool ext::is_vec_v'
126 | constexpr bool is_vec_v = vec_type<T>::value;
| ^~~~~~~~
a.cc:10:24: note: 'template<class T> constexpr const bool ext::is_vec_v<T>' previously declared here
10 | constexpr bool is_vec_v;
| ^~~~~~~~
|
s308143659 | p03879 | C++ | #include<iostream>
using namespace std;
int main(){
double x1,y1,x2,y2,x3,y3;
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
double a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
double b=sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
double c=sqrt((x1-x3)*(x1-x3)+(y1-y3)*(y1-y3));
double s=abs((x2-x1)*(y3-y1)-(y2-y1)*(x3-x1))/2.0;
double r=2*s/(a+b+c);
cout << r*max({a,b,c})/(2+max({a,b,c})) << endl;
} | a.cc: In function 'int main()':
a.cc:8:12: error: 'sqrt' was not declared in this scope
8 | double a=sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
| ^~~~
a.cc:15:16: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
15 | cout << r*max({a,b,c})/(2+max({a,b,c})) << endl;
| ~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:51,
from /usr/include/c++/14/bits/locale_classes.h:40,
from /usr/include/c++/14/bits/ios_base.h:41,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided
a.cc:15:32: error: no matching function for call to 'max(<brace-enclosed initializer list>)'
15 | cout << r*max({a,b,c})/(2+max({a,b,c})) << endl;
| ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate expects 2 arguments, 1 provided
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate expects 3 arguments, 1 provided
|
s918601469 | p03879 | C++ | A=list(map(int,input().split()))
x1=A[0]
y1=A[1]
B=list(map(int,input().split()))
x2=B[0]
y2=B[1]
C=list(map(int,input().split()))
x3=C[0]
y3=C[1]
a=((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))**0.5
b=((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1))**0.5
c=((x2-x3)*(x2-x3)+(y2-y3)*(y2-y3))**0.5
S=abs((x2-x1)*(y3-y1)-(x3-x1)*(y2-y1))/2
print(2*S/(a+b+c+4*S/(max(a,b,c))))
| a.cc:1:1: error: 'A' does not name a type
1 | A=list(map(int,input().split()))
| ^
|
s324571588 | p03879 | C++ | #include <algorithm>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define int long long
#define ll long long
#define eps LDBL_EPSILON
#define mod 998244353
#define double long double
#define INF LLONG_MAX/1000
#define P pair<int,int>
#define prique priority_queue
using namespace std;
double x[3], y[3], d[3];
signed main() {
rep(i, 3)cin >> x[i] >> y[i];
d[0] = hypot(x[0] - x[1], y[0] - y[1]);
d[1] = hypot(x[1] - x[2], y[1] - y[2]);
d[2] = hypot(x[2] - x[0], y[2] - y[0]);
double s = (d[0] + d[1] + d[2]) / 2;
double S = sqrt(s * (s - d[0]) * (s - d[1]) * (s - d[2]));
double r = S / s;
double mi = 0, ma = 1000;
while (ma - mi > eps) {
double md = (mi + ma) / 2;
if (r < md)ma = md;
else if (max({ d[0],d[1],d[2] }) / r * (r - md) >= 2 * md)mi = md;
else ma = md;
}
printf("%.12Lf %.12Lf\n", mi,ma);
return 0;
} | a.cc: In function 'int main()':
a.cc:21:13: error: 'LDBL_EPSILON' was not declared in this scope
21 | #define eps LDBL_EPSILON
| ^~~~~~~~~~~~
a.cc:38:26: note: in expansion of macro 'eps'
38 | while (ma - mi > eps) {
| ^~~
|
s495411677 | p03879 | C++ | #include <cmath>
#include <iomanip>
#include <iostream>
using namespace std;
#define gsort(b, e) sort(b, e, greater<decltype(*b)>())
template <typename T>
T sq(T a) {
return a * a;
}
int main() {
double x[3], y[3];
for (int i = 0; i < 3; ++i) {
cin >> x[i] >> y[i];
}
// (x[0], y[0])を原点に平行移動
for (int i = 2; i >= 0; --i) {
x[i] -= x[0];
y[i] -= y[0];
}
// 三角形の面積
double S = abs(x[1] * y[2] - x[2] * y[1]) / 2;
// 各辺の長さ
double r[3];
for (int i = 0; i < 3; ++i) {
r[i] = sqrt(sq(x[i] - x[(i + 1) % 3]) + sq(y[i] - y[(i + 1) % 3]));
}
// 内接円の半径
double z = S * 2 / (r[0] + r[1] + r[2]);
gsort(r, r + 3);
double ok = 0, ng = 1000;
for (int i = 0; i < 100; ++i) {
double mid = (ok + ng) / 2;
if (mid * 2 <= r[0] * (1 - mid / z)) {
ok = mid;
} else {
ng = mid;
}
}
cout << fixed << setprecision(15) << ok << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:5:21: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
5 | #define gsort(b, e) sort(b, e, greater<decltype(*b)>())
| ^~~~
a.cc:35:5: note: in expansion of macro 'gsort'
35 | gsort(r, r + 3);
| ^~~~~
|
s322314781 | p03879 | C++ | #include <iostream>
#include <cmath>
using namespace std;
double coss(int a,int b,int c,int d,int e,int f){
int aba,abb;
aba = (c - a) * (c - a) + (d - b) * (d - b);
abb = (e -a) * (e- a) + (f- b) * (f- b);
int mul = (c-a)*(e-a) + (d-b)*(f-b);
double absol= sqrt((double) aba)*sqrt((double) abb);
return (double)mul / absol;
}
double abso(int a,int b,int c,int d){
return
(double)
sqrt((c - a) * (c - a) + (d - b) * (d - b));
}
bool check(double th1,double th2, int a,int b,int c,int d,double r){
double l1 = r / sin(th1);
double l2 = r / sin(th2);
double avx,avy,bvx,bvy;
avx = (cos(th1)*()
int main(){
int a,b; cin >> a >> b;
int c,d; cin >> c >> d;
int e,f; cin >> e >> f;
double ans = 0;
double th1= acos(coss(a,b,c,d,e,f)) / 2.0;
double th2= acos(coss(c,d,a,b,e,f)) / 2.0;
double ok=0.0,ng = 1000.0;
while(ng - ok < 0.000000001){
double mid = (ng + ok) / 2.0;
if(check(th1,th2,a,b,c,d,mid)){
ok = mid;
}else{
ng = mid;
}
}
ans = ok;
| a.cc: In function 'bool check(double, double, int, int, int, int, double)':
a.cc:24:20: error: expected primary-expression before ')' token
24 | avx = (cos(th1)*()
| ^
a.cc:24:21: error: expected ')' before 'int'
24 | avx = (cos(th1)*()
| ~ ^
| )
......
27 | int main(){
| ~~~
a.cc:44:12: error: expected '}' at end of input
44 | ans = ok;
| ^
a.cc:20:68: note: to match this '{'
20 | bool check(double th1,double th2, int a,int b,int c,int d,double r){
| ^
a.cc:44:12: warning: no return statement in function returning non-void [-Wreturn-type]
44 | ans = ok;
| ^
|
s770518459 | p03879 | C++ | #include <bits/stdc++.h>
#include <vector>
#define REP(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
#define MOD 1000000007
//ll dx[4] = {1,-1,0,0};
//ll dy[4] = {0,0,1,-1};
/*ll pasc[100][100];
ll getPasc(ll n,ll k){
if(pasc[n][k]!=0){
return pasc[n][k];
}else{
pasc[n][k] = getPasc(n-1,k-1)+getPasc(n-1,k);
return pasc[n][k];
}
}*/
double getMaxR(double kakuA,double kakuB,double abL,double ra,double rb){
double r;
if((rb-ra)<=0.000000001){
return (ra+rb)/2;
}
r = (ra+rb)/2;
double x,y;
x = r/(tan(kakuA/2));
y = r/(tan(kakuB/2));
if((x+y+2*r)>abL){
return getMaxR(kakuA,kakuB,abL,ra,r);
}else{
return getMaxR(kakuA,kakuB,abL,r,rb);
}
}
int main(){
pair<double,double> vec2;
vec2 a,b,c;
cin>>a.first>>a.second>>b.first>>b.second>>c.first>>c.second;
vec2 ab,bc,ca;
ab.first = b.first-a.first;
ab.second = b.second-a.second;
bc.first = c.first-b.first;
bc.second = c.second-b.second;
ca.first = a.first-c.first;
ca.second = a.second-c.second;
double abL,bcL,caL;
abL = sqrt(pow(ab.first,2.0)+pow(ab.second,2.0));
bcL = sqrt(pow(bc.first,2.0)+pow(bc.second,2.0));
caL = sqrt(pow(ca.first,2.0)+pow(ca.second,2.0));
double kakuA,kakuB,kakuC;
/*vec2 abE,bcE,caE;
abE.first = ab.first/abL;
abE.second = ab.second/abL;
bcE.first = bc.first/bcL;
bcE.second = bc.second/bcL;
caE.first = ca.first/caL;
caE.second = ca.second/caL;*/
kakuA = abs(tanh(ab.first/ab.second)-tanh(-ca.first/(-ca.second)));
kakuB = abs(tanh(bc.first/bc.second)-tanh(-ab.first/(-ab.second)));
kakuC = abs(tanh(ca.first/ca.second)-tanh(-bc.first/(-bc.second)));
double r;
r = getMaxR(kakuA,kakuB,abL,0,500);
r = max(r,getMaxR(kakuB,kakuC,bcL,0,500));
r = max(r,getMaxR(kakuC,kakuA,caL,0,500));
cout<<r<<endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:38:7: error: expected ';' before 'a'
38 | vec2 a,b,c;
| ^~
| ;
a.cc:39:8: error: 'a' was not declared in this scope
39 | cin>>a.first>>a.second>>b.first>>b.second>>c.first>>c.second;
| ^
a.cc:39:27: error: 'b' was not declared in this scope
39 | cin>>a.first>>a.second>>b.first>>b.second>>c.first>>c.second;
| ^
a.cc:39:46: error: 'c' was not declared in this scope
39 | cin>>a.first>>a.second>>b.first>>b.second>>c.first>>c.second;
| ^
a.cc:40:7: error: expected ';' before 'ab'
40 | vec2 ab,bc,ca;
| ^~~
| ;
a.cc:41:3: error: 'ab' was not declared in this scope; did you mean 'abs'?
41 | ab.first = b.first-a.first;
| ^~
| abs
a.cc:43:3: error: 'bc' was not declared in this scope
43 | bc.first = c.first-b.first;
| ^~
a.cc:45:3: error: 'ca' was not declared in this scope
45 | ca.first = a.first-c.first;
| ^~
|
s359328779 | p03879 | C++ | #include <iostream>
#include <iomanip>
#include <complex>
#include <vector>
#include <cassert>
#include <algorithm>
#include <cmath>
#include <queue>
#include <utility>
using namespace std;
//num
const double EPS = 1e-10;
const double INF = 1e12;
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)
// point, line, circle
typedef complex<double> P;
typedef vector<P> VP;
struct C{
P p;
double r;
C(const P& p, const double& r) : p(p), r(r) {}
};
namespace std{
bool operator < (const P& a, const P& b){
return (a.X != b.X)? a.X < b.X : a.Y < b.Y;
}
}
// vector operation
double dot(P a, P b){
return (conj(a)*b).X;
}
double cross(P a, P b){
return (conj(a)*b).Y;
}
//utility
int ccw(P a, P b, P c){
b -= a;
c -= a;
if(cross(b,c) > EPS) return +1; //counter clockwise
if(cross(b,c) <-EPS) return -1; //clockwise
if(dot(b,c) < EPS) return +2; //c-a-b
if(norm(b) < norm(c)) return -2; //a-b-c
return 0; //a-c-b
}
int main(){
vector<P> v(3);
for(int i=0; i<3; i++){
cin >> v[i].X >> v[i].Y;
}
vector<double> len(3);
vector<double> angle(3);
for(int i=0; i<3; i++){
len[i] = abs(v[(i+1)%3]-v[(i+2)%3]);
P e1 = v[(i+1)%3]-v[i];
P e2 = v[(i+2)%3]-v[i];
angle[i] = tan( acos( dot(e1,e2)/(abs(e1)*abs(e2)) ) *0.5 );
}
double ans=0;
for(int i=0; i<3; i++){
ans = max(ans, len[i]/(2.0 +(1/angle[(i+1)%3]) +(1/angle[(i+2)%3])) );
}
cout << fixed;
cout << setprecision(11);
cout << ans << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:57:9: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'double')
57 | cin >> v[i].X >> v[i].Y;
| ~~~ ^~
| |
| std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
from a.cc:1:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:15: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'double'
15 | #define X real()
| ^
a.cc:57:17: note: in expansion of macro 'X'
57 | cin >> v[i].X >> v[i].Y;
| ^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:15: error: cannot bind non-const lvalue reference of type 'short int&' to a value of type 'double'
15 | #define X real()
| ^
a.cc:57:17: note: in expansion of macro 'X'
57 | cin >> v[i].X >> v[i].Y;
| ^
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:15: error: cannot bind non-const lvalue reference of type 'short unsigned int&' to a value of type 'double'
15 | #define X real()
| ^
a.cc:57:17: note: in expansion of macro 'X'
57 | cin >> v[i].X >> v[i].Y;
| ^
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:15: error: cannot bind non-const lvalue reference of type 'int&' to a value of type 'double'
15 | #define X real()
| ^
a.cc:57:17: note: in expansion of macro 'X'
57 | cin >> v[i].X >> v[i].Y;
| ^
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:15: error: cannot bind non-const lvalue reference of type 'unsigned int&' to a value of type 'double'
15 | #define X real()
| ^
a.cc:57:17: note: in expansion of macro 'X'
57 | cin >> v[i].X >> v[i].Y;
| ^
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:15: error: cannot bind non-const lvalue reference of type 'long int&' to a value of type 'double'
15 | #define X real()
| ^
a.cc:57:17: note: in expansion of macro 'X'
57 | cin >> v[i].X >> v[i].Y;
| ^
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:15: error: cannot bind non-const lvalue reference of type 'long unsigned int&' to a value of type 'double'
15 | #define X real()
| ^
a.cc:57:17: note: in expansion of macro 'X'
57 | cin >> v[i].X >> v[i].Y;
| ^
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:15: error: cannot bind non-const lvalue reference of type 'long long int&' to a value of type 'double'
15 | #define X real()
| ^
a.cc:57:17: note: in expansion of macro 'X'
57 | cin >> v[i].X >> v[i].Y;
| ^
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:15: error: cannot bind non-const lvalue reference of type 'long long unsigned int&' to a value of type 'double'
15 | #define X real()
| ^
a.cc:57:17: note: in expansion of macro 'X'
57 | cin >> v[i].X >> v[i].Y;
| ^
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:15: error: cannot bind non-const lvalue reference of type 'float&' to a value of type 'double'
15 | #define X real()
| ^
a.cc:57:17: note: in expansion of macro 'X'
57 | cin >> v[i].X >> v[i].Y;
| ^
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:15: error: cannot bind non-const lvalue reference of type 'double&' to an rvalue of type 'double'
15 | #define X real()
| ^
a.cc:57:17: note: in expansion of macro 'X'
57 | cin >> v[i].X >> v[i].Y;
| ^
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:7: note: conversion of argument 1 would be ill-formed:
a.cc:15:15: error: cannot bind non-const lvalue reference of type 'long double&' to a value of type 'double'
15 | #define X real()
| ^
a.cc:57:17: note: in expansion of macro 'X'
57 | cin >> v[i].X >> v[i].Y;
| ^
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from 'double' to 'void*&'
328 | operator>>(void*& __p)
| ~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from 'double' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/istream:126:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>; __ios_type = std::basic_ios<char>]'
126 | operator>>(__ios_type& (*_ |
s854181088 | p03879 | C++ | #include <cstdio>
#include <algorithm>
#include <cmath>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <cstdlib>
#include <complex>
using namespace std;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define Fst first
#define Snd second
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repv(t,it,v) for(vector<t>::iterator it = v.begin() ; it != v.end() ; ++it)
typedef complex<double> vec2;
const double EA = 1e-9;
double dot(vec2 a , vec2 b){
return a.real() * b.real() + a.imag() * b.imag();
}
double cross(vec2 a , vec2 b){
return a.real() * b.imag() - a.imag() * b.real();
}
double pab(vec2 a , vec2 b){
return abs(vec2(a - b));
}
double dis(vec2 a , vec2 b , vec2 c){
return fabs(cross(a - c , b - c)) / pab(b , c);
}
int x1,x2,x3,y1,y2,y3;
vec2 p1,p2,p3;
vec2 q;
double h;
double d1,d2,d3;
bool eval(double a){
return d3 * (h-a) / h >= 2 * a;
}
double BS(double a , double b , int t){
double c = (a+b) / 2.0;
if(t == 100) return c;
return eval(c) ? BS(c,b,t+1) : BS(a,c,t+1);
}
int main(){
scanf("%d%d%d%d%d%d" , &x1 , &y1 , &x2 , &y2 , &x3 , &y3);
p1 = vec2(x1,y1);
p2 = vec2(x2,y2);
p3 = vec2(x3,y3);
d1 = pab(p2,p3);
d2 = pab(p3,p1);
d3 = pab(p1,p2);
if(d1 >= d2 && d1 >= d3){
swap(p1,p3);
swap(d1,d3);
} else if(d2 >= d3 && d2 >= d1){
swap(p2,p3);
swap(d2,d3);
}
double s = d1+d2+d3;
q = d1 / s * p1 + d2 / s * p2 + d3 / s * p3;
h = dis(q,p1,p2);
if(h==0.0) return 0;
printf("%.9f\n" , BS(0.0,h,0));
return 0;
}
| a.cc:46:14: error: 'int y1' redeclared as different kind of entity
46 | int x1,x2,x3,y1,y2,y3;
| ^~
In file included from /usr/include/features.h:523,
from /usr/include/x86_64-linux-gnu/c++/14/bits/os_defines.h:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/c++config.h:683,
from /usr/include/c++/14/cstdio:41,
from a.cc:1:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:257:1: note: previous declaration 'double y1(double)'
257 | __MATHCALL (y1,, (_Mdouble_));
| ^~~~~~~~~~
a.cc: In function 'int main()':
a.cc:64:24: error: no matching function for call to 'std::complex<double>::complex(int&, double (&)(double) noexcept)'
64 | p1 = vec2(x1,y1);
| ^
In file included from a.cc:9:
/usr/include/c++/14/complex:1986:3: note: candidate: 'constexpr std::complex<double>::complex(const std::complex<long double>&)'
1986 | complex<double>::complex(const complex<long double>& __z)
| ^~~~~~~~~~~~~~~
/usr/include/c++/14/complex:1986:3: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/complex:1534:26: note: candidate: 'constexpr std::complex<double>::complex(const std::complex<float>&)'
1534 | _GLIBCXX_CONSTEXPR complex(const complex<float>& __z)
| ^~~~~~~
/usr/include/c++/14/complex:1534:26: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/complex:1525:28: note: candidate: 'constexpr std::complex<double>::complex(const std::complex<double>&)'
1525 | _GLIBCXX14_CONSTEXPR complex(const complex&) = default;
| ^~~~~~~
/usr/include/c++/14/complex:1525:28: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/complex:1514:26: note: candidate: 'constexpr std::complex<double>::complex(double, double)'
1514 | _GLIBCXX_CONSTEXPR complex(double __r = 0.0, double __i = 0.0)
| ^~~~~~~
/usr/include/c++/14/complex:1514:59: note: no known conversion for argument 2 from 'double(double) noexcept' to 'double'
1514 | _GLIBCXX_CONSTEXPR complex(double __r = 0.0, double __i = 0.0)
| ~~~~~~~^~~~~~~~~
/usr/include/c++/14/complex:1512:26: note: candidate: 'constexpr std::complex<double>::complex(_ComplexT)'
1512 | _GLIBCXX_CONSTEXPR complex(_ComplexT __z) : _M_value(__z) { }
| ^~~~~~~
/usr/include/c++/14/complex:1512:26: note: candidate expects 1 argument, 2 provided
|
s248743917 | p03880 | Java | import java.io.*;
import java.util.*;
class Main {
static Scanner scanner = new Scanner();
static long mod = 1000000007;
public static void main(String[]$) {
int n = scanner.nextInt();
int xor = 0;
boolean[] x = new boolean[32];
for (int i = 0; i < n; i++) {
int a = scanner.nextInt();
x[Integer.toBinaryString((a - 1) ^ a).length() - 1] = true;
xor ^= a;
}
long ans = 0;
for (int i = Integer.toBinaryString(Integer.highestOneBit(xor) - 1).length(); i >= 0; i--) {
int j = 1 << i;
if ((xor & j) != 0) {
if (x[i]) {
ans++;
xor ^= j * 2 - 1;
} else {
System.out.println(-1);
return;
}
}
}
System.out.println(ans);
}
static class Scanner {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
StringTokenizer tokenizer;
String next() {
try {
while (tokenizer == null || !tokenizer.hasMoreTokens()) {
tokenizer = new StringTokenizer(reader.readLine());
}
} catch (IOException ignored) {
}
return tokenizer.nextToken();
}
int nextInt() {
return Integer.parseInt(next());
}
long nextLong() {
return Long.parseLong(next());
}
}
}j | Main.java:55: error: reached end of file while parsing
}j
^
1 error
|
s906147046 | p03880 | C++ | #include "pch.h"
#include<iostream>
#include<vector>
#include<set>
#include<queue>
#include<map>
#include<algorithm>
#include<cstring>
#include<string>
#include<cassert>
#include<cmath>
#include<climits>
#include<iomanip>
#include<stack>
using namespace std;
#define MOD 1000000007
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
typedef pair<ll, ll> P;
const long long INF = 1LL << 60;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
template<class T> inline bool chmin(T& a, T b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template<class T> inline bool chmax(T& a, T b) {
if (a < b) {
a = b;
return true;
}
return false;
}
struct Edge {//グラフ
ll to, cap, rev;
Edge(ll _to, ll _cap, ll _rev) {
to = _to; cap = _cap; rev = _rev;
}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {//最大フロー求める Ford-fulkerson
G[from].push_back(Edge(to, cap, (ll)G[to].size()));
if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));//最小カットの場合逆辺は0にする
}
ll max_flow_dfs(Graph & G, ll v, ll t, ll f, vector<bool> & used)
{
if (v == t)
return f;
used[v] = true;
for (int i = 0; i < G[v].size(); ++i) {
Edge& e = G[v][i];
if (!used[e.to] && e.cap > 0) {
ll d = max_flow_dfs(G, e.to, t, min(f, e.cap), used);
if (d > 0) {
e.cap -= d;
G[e.to][e.rev].cap += d;
return d;
}
}
}
return 0;
}
ll max_flow(Graph & G, ll s, ll t)
{
ll flow = 0;
for (;;) {
vector<bool> used(G.size());
REP(i, used.size())used[i] = false;
ll f = max_flow_dfs(G, s, t, INF, used);
if (f == 0) {
return flow;
}
flow += f;
}
}
void BellmanFord(Graph& G, ll s, Array& d, Array &negative) {//O(|E||V|)
d.resize(G.size());
negative.resize(G.size());
REP(i, d.size())d[i] = INF;
REP(i, d.size())negative[i] = false;
d[s] = 0;
REP(k, G.size() - 2) {
REP(i, G.size()) {
REP(j, G[i].size()) {
if (d[G[i][j].to] > d[i] + G[i][j].cap) {
d[G[i][j].to] = d[i] + G[i][j].cap;
}
}
}
}
REP(k, G.size() - 2) {
REP(i, G.size()) {
REP(j, G[i].size()) {
if (d[G[i][j].to] > d[i] + G[i][j].cap) {
d[G[i][j].to] = d[i] + G[i][j].cap;
negative[G[i][j].to] = true;
}
if (negative[i] == true)negative[G[i][j].to] = true;
}
}
}
}
void Dijkstra(Graph& G, ll s, Array& d) {//O(|E|log|V|)
d.resize(G.size());
REP(i, d.size())d[i] = INF;
d[s] = 0;
priority_queue<P, vector<P>, greater<P>> q;
q.push(make_pair(0, s));
while (!q.empty()) {
P a = q.top();
q.pop();
if (d[a.second] < a.first)continue;
REP(i, G[a.second].size()) {
Edge e = G[a.second][i];
if (d[e.to] > d[a.second] + e.cap) {
d[e.to] = d[a.second] + e.cap;
q.push(make_pair(d[e.to], e.to));
}
}
}
}
void WarshallFloyd(Graph& G, Matrix& d) {
d.resize(G.size());
REP(i, d.size())d[i].resize(G.size());
REP(i, d.size()) {
REP(j, d[i].size()) {
d[i][j] = INF;
}
}
REP(i, G.size()) {
d[i][i] = 0;
}
REP(i, G.size()) {
REP(j, G[i].size()) {
d[i][G[i][j].to] = G[i][j].cap;
}
}
REP(i, G.size()) {
REP(j, G.size()) {
REP(k, G.size()) {
chmin(d[j][k], d[j][i] + d[i][k]);
}
}
}
}
class UnionFind {
vector<int> data;
public:
UnionFind(int size) : data(size, -1) { }
bool unionSet(int x, int y) {
x = root(x); y = root(y);
if (x != y) {
if (data[y] < data[x]) swap(x, y);
data[x] += data[y]; data[y] = x;
}
return x != y;
}
bool findSet(int x, int y) {
return root(x) == root(y);
}
int root(int x) {
return data[x] < 0 ? x : data[x] = root(data[x]);
}
int size(int x) {
return -data[root(x)];
}
};
//約数求める //約数
void divisor(ll n, vector<ll>& ret) {
for (ll i = 1; i * i <= n; i++) {
if (n % i == 0) {
ret.push_back(i);
if (i * i != n) ret.push_back(n / i);
}
}
sort(ret.begin(), ret.end());
}
//nCrとか
class Combination {
public:
Array fact;
Array inv;
ll mod;
ll mod_inv(ll x) {
ll n = mod - 2;
ll res = 1LL;
while (n > 0) {
if (n & 1) res = res * x % mod;
x = x * x % mod;
n >>= 1;
}
return res;
}
ll nCr(ll n, ll r) {
return ((fact[n] * inv[r] % mod) * inv[n - r]) % mod;
}
ll nPr(ll n, ll r) {
return (fact[n] * inv[n - r]) % mod;
}
Combination(ll n, ll _mod) {
mod = _mod;
fact.resize(n + 1);
fact[0] = 1;
REP(i, n) {
fact[i + 1] = (fact[i] * (i + 1LL)) % mod;
}
inv.resize(n + 1);
REP(i, n + 1) {
inv[i] = mod_inv(fact[i]);
}
}
};
ll gcd(ll m, ll n) {
if (n == 0)return m;
return gcd(n, m % n);
}//gcd
ll lcm(ll m, ll n) {
return m / gcd(m, n) * n;
}
int main() {
ll n;
cin >> n;
Array a(n);
set<ll> bit;
ll ini = 0;
REP(i, n) {
cin >> a[i];
ini ^= a[i];
ll num = 1;
while (a[i]) {
if (a[i] % 2 == 1) {
bit.insert(num);
break;
}
else {
a[i] /= 2;
num++;
}
}
}
Array bits(40, 0);
ll num = 1;
while (ini) {
if (ini % 2 == 1) bits[num] = 1;
ini /= 2;
num++;
}
ll cnt = 0;
for (int i = 39; i >= 1; i--) {
if (bits[i] == 1) {
if (bit.count(i) == 1) {
cnt++;
for (int j = i; j >= 1; j--) {
bits[j] ^= 1;
}
}
else {
cout << -1;
return 0;
}
}
}
cout << cnt;
return 0;
} | a.cc:1:10: fatal error: pch.h: No such file or directory
1 | #include "pch.h"
| ^~~~~~~
compilation terminated.
|
s522696378 | p03880 | C++ | #include <iostream>
#include <map>
using namespace std;
int main() {
int r = 0, n;
cin >> n;
map<int, int> m;
for (int i = 0; i < n; ++i) {
int a;
scanf("%d", &a);
r ^= a;
int u = __builtin_ffs(a);
if(!m[u-1]) m[u-1]=a;
}
int x = 1 << 30, ans = 0;
for (int p = 30; p >= 0; --p) {
if(r & x){
if(!m[p]) {
puts("-1");
return 0;
}else {
r ^= m[p][0];
r ^= (m[p][0]-1);
ans++;
}
}
x /= 2;
}
cout << ans << "\n";
return 0;
}
| a.cc: In function 'int main()':
a.cc:24:26: error: invalid types 'std::map<int, int>::mapped_type {aka int}[int]' for array subscript
24 | r ^= m[p][0];
| ^
a.cc:25:27: error: invalid types 'std::map<int, int>::mapped_type {aka int}[int]' for array subscript
25 | r ^= (m[p][0]-1);
| ^
|
s605628676 | p03880 | C++ | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
const int INF = 1e9;
int N;
long long A[MAXN + 10];
long long lg(long long x) {
int cc = 0;
while(x > 1) {
x >>= 1;
cc++;
}
return cc;
}
bool cnt[40];
int main() {
scanf("%d", &N);
for(int i = 0; i < N; i++) {
scanf("%lld", &A[i]);
if((A[i] & (A[i] - 1LL)) == 0LL) {
cnt[lg(A[i])] = true;
}
}
long long xr = 0;
for(int i = 0; i < N; i++) {
xr ^= A[i];
}
int res = 0;
for(long long i = 30; i > 0; i--) {
if(xr & (1LL << i)) {
if(!cnt[i]) {
print("-1\n");
exit(0);
}
xr ^= 1LL << i;
xr ^= (1LL << i) - 1LL;
res++;
}
}
int cc = N;
for(int i = 0; i < N; i++) {
if((A[i] & (A[i] - 1LL)) == 0LL) cc--;
}
if(xr == 0LL) printf("%d\n", res);
else if(xr == 1LL && cc > 0LL) printf("%d\n", res+1);
else printf("-1\n");
}
| a.cc: In function 'int main()':
a.cc:38:13: error: 'print' was not declared in this scope; did you mean 'rint'?
38 | print("-1\n");
| ^~~~~
| rint
|
s276289965 | p03880 | C++ | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5;
const int INF = 1e9;
int N;
int A[MAXN + 10];
void done(int xr) {
printf("%d\n", xr);
exit(0);
}
int lg(int x) {
int cc = 0;
while(x > 1) {
x >>= 1;
cc++;
}
return cc;
}
bool cnt[40];
int main() {
scanf("%d", &N);
for(int i = 0; i < N; i++) {
scanf("%d", &A[i]);
if((A[i] & (A[i] - 1)) == 0) {
cnt[lg(A[i])] = true;
//cerr << "cnt[lg(" << A[i] << ") = " << lg(A[i]) << "] = true\n";
}
}
int xr = 0;
for(int i = 0; i < N; i++) {
xr ^= A[i];
}
int res = 0;
for(int i = 30; i > 0; i--) {
if(xr & (1 << i)) {
if(!cnt[i]) {
print("-1\n");
exit(0);
}
xr ^= 1 << i;
xr ^= (1 << i) - 1;
res++;
}
}
int cc = N;
for(int i = 0; i < N; i++) {
if((A[i] & (A[i] - 1)) == 0) cc--;
}
if(xr == 0) printf("%d\n", res);
else if(xr == 1 && cc > 0) printf("%d\n", res+1);
else printf("-1\n");
}
| a.cc: In function 'int main()':
a.cc:43:13: error: 'print' was not declared in this scope; did you mean 'rint'?
43 | print("-1\n");
| ^~~~~
| rint
|
s658134924 | p03880 | C++ | #include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define RFOR(i,m,n) for(int i=m;i>=n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
int n;
int a[1000000];
int x=0;
int main(){
cin>>n;
rep(i,n){
cin>>a[i];
x = x^a[i];
}
int ans=0;
for (int k=30; k>=1; k--) {
if (x == 0) break;
if (!(x>>(k-1) & 1)) continue;
for (size_t i=0; i<N; ++i) {
if ((a[i]^(a[i]-1)) == (1<<k)-1) {
x ^= (1<<k)-1;
++res;
a[i] = 0;
break;
}
}
}
if(x!=0){
cout<<-1<<endl;
}
else{
cout<<ans<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:34:24: error: 'N' was not declared in this scope
34 | for (size_t i=0; i<N; ++i) {
| ^
a.cc:37:11: error: 'res' was not declared in this scope; did you mean 'rep'?
37 | ++res;
| ^~~
| rep
|
s438798226 | p03880 | C++ | #include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define RFOR(i,m,n) for(int i=m;i>=n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
int n;
int a[1000000];
int x=0;
int main(){
cin>>n;
rep(i,n){
cin>>a[i];
x = x^a[i];
}
int res=0;
for (int k=30; k>=1; k--) {
if (x == 0) break;
if (!(x>>(k-1) & 1)) continue;
for (size_t i=0; i<N; ++i) {
if ((a[i]^(a[i]-1)) == (1<<k)-1) {
x ^= (1<<k)-1;
++res;
a[i] = 0;
break;
}
}
}
if(x!=0){
cout<<-1<<endl;
}
else{
cout<<ans<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:34:24: error: 'N' was not declared in this scope
34 | for (size_t i=0; i<N; ++i) {
| ^
a.cc:49:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
49 | cout<<ans<<endl;
| ^~~
| abs
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.