submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s195466825 | p00650 | C++ | #include <bits/stdc++.h>
using namespace std;
#define MAX 110
#define INF INT_MAX
typedef pair<int, int> pii;
struct Edge {
int from, to, cost;
Edge(int from, int to, int cost) :
from(from), to(to), cost(cost) {}
};
int N, M;
vector<Edge> G[MAX], cycle;
int color[MAX];
void dfs(int v, vector<Edge> u)javascript:void(0)
{
color[v] = 0;
for(int i = 0; i < (int)G[v].size(); i++) {
Edge &e = G[v][i];
int to = e.to;
if (color[to] == -1) {
u.push_back(G[v][i]);
dfs(to, u);
u.pop_back();
} else if(color[to] == 0) {
color[to] = 1;
u.push_back(G[v][i]);
cycle = u;
u.pop_back();
throw 0;
}
}
color[v] = 1;
}
bool solve()
{
vector<Edge> vec;
memset(color, -1, sizeof(color));
for (int i = 0; i < N; i++) {
try {
if (color[i] == -1) {
dfs(i, vec);
}
} catch (...) {
break;
}
vec.clear();
}
return (cycle.size() > 0);
}
void init()
{
cycle.clear();
for (int i = 0; i < MAX; i++) {
G[i].clear();
}
}
class Union_Find {
public:
int par[MAX], rank[MAX], size[MAX], gnum;
Union_Find(int N) {
gnum = N;
for (int i = 0; i < N; i++) {
par[i] = i;
rank[i] = 0;
size[i] = 1;
}
}
int find(int x)
{
if (par[x] == x) {
return x;
}
return par[x] = find(par[x]);
}
void unite(int x, int y)
{
x = find(x);
y = find(y);
if (x == y) return;
if (rank[x] < rank[y]) {
par[x] = y;
size[y] += size[x];
} else {
par[y] = x;
size[x] += size[y];
if (rank[x] == rank[y]) {
rank[x]++;
}
}
gnum--;
}
bool same(int x, int y)
{
return (find(x) == find(y));
}
int getSize(int x)
{
return size[find(x)];
}
int groups()
{
return gnum;
}
};
int main()
{
int s, t, cost;
while (cin >> N >> M, N) {
int min_cost = 0, min_cost2 = INF;
init();
Union_Find uf(N);
for (int i = 0; i < M; i++) {
cin >> s >> t >> cost;
if (cost > 0) {
G[s].push_back(Edge(s, t, cost));
uf.unite(s, t);
min_cost2 = min(min_cost2, cost);
} else {
min_cost += cost;
}
}
if (uf.gnum == 1) {
if (solve()) {
min_cost2 = INF;
set<pii> st;
vector<int> v;
for (int i = 0; i < (int)cycle.size(); i++) {
v.push_back(cycle[i].cost);
st.insert(pii(cycle[i].from, cycle[i].to));
}
sort(v.begin(), v.end());
min_cost2 = v[0] + v[1];
for (int i = 0; i < N; i++) {
for (int j = 0; j < (int)G[i].size(); i++) {
Edge &e = G[i][j];
if (st.count(pii(e.from, e.to)) == 0) {
min_cost2 = min(min_cost, e.cost + min(0, v[0]));
}
}
}
}
} else {
min_cost2 = 0;
}
cout << min_cost + min_cost2 << endl;
}
return 0;
} | a.cc:20:32: error: expected initializer before 'javascript'
20 | void dfs(int v, vector<Edge> u)javascript:void(0)
| ^~~~~~~~~~
a.cc: In function 'bool solve()':
a.cc:48:17: error: 'dfs' was not declared in this scope; did you mean 'ffs'?
48 | dfs(i, vec);
| ^~~
| ffs
|
s485529631 | p00650 | C++ | #include<algorithm>
using namespace std;
int main(){
int n,m;
int x[100],y[100],c[100];
int r[100],tmp1,tmp2;
int cost,total;
int i,j;
while(1){
cin >> n >> m;
if(!n && !m)break;
total = 0;
for(i=0;i<m;i++){
cin >> x[i] >> y[i] >> c[i];
total += c[i];
}
for(i=0;i<n;i++)r[i] = i;
for(i=0;i<m;i++){
for(j=i+1;j<m;j++){
if(c[i] < c[j]){
swap(x[i],x[j]);
swap(y[i],y[j]);
swap(c[i],c[j]);
}
}
}
cost = 0;
for(i=0;i<m;i++){
tmp1 = r[0];
tmp2 = -1;
for(j=1;j<n;j++){
if(tmp1 != r[j]){
if(tmp2 < 0)tmp2 = r[j];
else if(tmp2 != r[j])break;
}
}
if(j==n)break;
if(r[x[i]] != r[y[i]]){
cost += c[i];
tmp1 = r[y[i]];
for(j=0;j<n;j++){
if(r[j] == tmp1)r[j] = r[x[i]];
}
}
}
i++;
while(c[i]>=0 && i<m){
if(r[x[i]] == r[y[i]])cost += c[i];
i++;
}
cout << total - cost << endl;
}
} | a.cc: In function 'int main()':
a.cc:12:5: error: 'cin' was not declared in this scope
12 | cin >> n >> m;
| ^~~
a.cc:2:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
1 | #include<algorithm>
+++ |+#include <iostream>
2 | using namespace std;
a.cc:58:5: error: 'cout' was not declared in this scope
58 | cout << total - cost << endl;
| ^~~~
a.cc:58:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:58:29: error: 'endl' was not declared in this scope
58 | cout << total - cost << endl;
| ^~~~
a.cc:2:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
1 | #include<algorithm>
+++ |+#include <ostream>
2 | using namespace std;
|
s419884555 | p00650 | C++ | #include<iostream>
#include<algorithm>
using namespace std;
int n,m;
int x[100],y[100],c[100];
bool use[100];
bool union_find(void){
int i,j;
int tmp,tmp2;
int g[100];
for(i=0;i<n;i++)g[i] = i;
for(i=0;i<m;i++){
if(g[x[i]]!=g[y[i]] && !use[i]){
tmp = g[x[i]];
for(j=0;j<n;j++){
if(g[j] == tmp)g[j] = g[y[i]];
}
}
}
tmp = g[0];
tmp2 = -1;
for(i=1;i<n;i++){
if(tmp != g[i]){
if(tmp2 < 0)tmp2 = g[i];
else if(tmp2 != g[i])return false;
}
}
if(tmp2 < 0)return false;
return true;
}
int main(){
int cost;
int i,j;
while(1){
cin >> n >> m;
if(!n && !m)break;
for(i=0;i<m;i++){
cin >> x[i] >> y[i] >> c[i];
use[m] = false;
}
if(union_find()){
cost = 0;
cout << "no reduce" << endl;
}
else cost = INT_MAX;
for(i=0;i<m;i++){
for(j=0;j<m;j++){
use[i] = true;
use[j] = true;
if(union_find()){
if(i==j){
if(cost > c[i])cost = c[i];
}else{
if(cost > c[i] + c[j])cost = c[i] + c[j];
}
}
use[i] = false;
use[j] = false;
}
}
cout << cost << endl;
}
} | a.cc: In function 'int main()':
a.cc:53:17: error: 'INT_MAX' was not declared in this scope
53 | else cost = INT_MAX;
| ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
2 | #include<algorithm>
+++ |+#include <climits>
3 | using namespace std;
|
s291010442 | p00650 | C++ | //poj 3469 2987 å¿«äº
//////////èç¹å·ã1ï¼nã,source,sink 为å
¶ä¸ä»»æç¹
#include <cstdio>
#include <cstring>
#define maxn 132
typedef __int64 LL;
LL inf;
using namespace std;
struct edge
{
int u,v,next, pre; LL f;
}e[100000];
int num,rnum; int n,m,N; int source,sink;
int head[maxn],rhead[maxn], start[maxn];
int d[maxn],numb[maxn];
int p[maxn];
void Init()
{
memset(head,-1,sizeof(head));///åé¾è¡¨å¿
须置 -1
memset(rhead,-1,sizeof(rhead));
memset(p,-1,sizeof(p));
num=0;///å¿
须为0
}
void BFS()
{
int i,j;
for(i=1;i<=N;i++)//////////èç¹å·ã1ï¼nã
{
d[i]=N;///åå§åæ¯ä¸ªèç¹çè·ç¦»ä¸ºæ 穷大 nå³å¯
numb[i]=0;
}
int Q[maxn],head(0),tail(0);
d[sink]=0;//æsinkæ¾å
¥éå
numb[0]=1;
Q[++tail]=sink;
while(head<tail)
{
i=Q[++head];
for(j=rhead[i];j!=-1;j=e[j].pre)
{
if(e[j].f==0||d[e[j].u]<N)
continue;///以åå°±å°è¾¾è¿æè
没æå¯æµéäº
d[e[j].u]=d[i]+1;
numb[d[e[j].u]]++;
Q[++tail]=e[j].u;
}
}
}
LL Augment()
{
int i; LL tmp=inf;
for(i=p[sink];i!=-1;i=p[e[i].u])
{
if(tmp>e[i].f)
tmp=e[i].f;
}
for(i=p[sink];i!=-1;i=p[e[i].u])
{
e[i].f-=tmp;////æ£è¾¹ï¼åè¾¹ç¸ç»§çï¼ä¸é´å·® 1
e[i^1].f+=tmp;
}
return tmp;
}
int Retreat(int &i)
{
int tmp,j,mind(N-1);
for(j=head[i];j!=-1;j=e[j].next)////æ¾æå°çè·¯å¾æ å·
{
if(e[j].f>0&&d[e[j].v]<mind)
mind=d[e[j].v];
}
tmp=d[i];///ä¿®æ¹ç¸åº è·¯å¾æ å·ç个æ°
d[i]=mind+1;
numb[tmp]--;
numb[d[i]]++;
if(i!=source)////ååèç¹
i=e[p[i]].u;
return numb[tmp];////è¿åæåièç¹çè·¯å¾æ å·dãiã ç个æ°,æå±åç»æ
}
LL maxflow()
{
LL flow(0);
int i,j;
BFS();
for(i=1;i<=N;i++)
start[i]=head[i];
//memcpy(start,head,sizeof(start));
i=source;
while(d[source]<N)
{
for(j=start[i];j!=-1;j=e[j].next)
if(e[j].f>0&&d[i]==d[e[j].v]+1)
break;
if(j!=-1)////æ¾å°å¢å¹¿çè·¯å¾
{
start[i]=j;
p[e[j].v]=j;
i=e[j].v;
if(i==sink)///å¢å¹¿å°äºsink
{
flow+=Augment();
i=source;
}
}
else ////没æå¢å¹¿è·¯ï¼
{
start[i]=head[i];
if(Retreat(i)==0)////éè¦éæ°æ è®°ï¼åãiï¼jãä¸jæå°çè·¯å¾æ å·
break;
}
}
return flow;
}
void addedge(int a,int b,LL c)
{
e[num].f=c;e[num].u=a; e[num].v=b;
e[num].next=head[a];head[a]=num;
e[num].pre=rhead[b];rhead[b]=num;
num++;
e[num].u=b;e[num].v=a;e[num].f=0;
e[num].next=head[b];head[b]=num;
e[num].pre=rhead[a];rhead[a]=num;
num++;
}
LL g[maxn][maxn];
inline LL min(LL a, LL b) { return a<b?a:b; }
int main()
{
int a,b; LL c;
while(scanf("%d%d",&n,&m)!=EOF)
{
if (n==0 && m==0) break;
N=n;
memset(g, 0, sizeof(g));
LL ans=0;
for (int i=0; i<m; i++)
{
scanf("%d %d %lld", &a, &b, &c);
a++; b++;
g[a][b]+=c;
//ans+=c;
if (c>0) ans+=c; else ans-=c;
}
inf=ans;
for (int i=2; i<=n; i++)
{
source=1;
sink=i;
Init();
LL tmp=0;
for (int j=1; j<=n; j++)
for (int k=1; k<=n; k++)
{
if (j==k) continue;
if (g[j][k]<0) tmp+=g[j][k];
if (g[j][k]>0) addedge(j, k, g[j][k]);
}
ans=min(ans, maxflow()+tmp);
}
printf("%lld\n", ans);
}
return 0;
} | a.cc:6:9: error: '__int64' does not name a type; did you mean '__int64_t'?
6 | typedef __int64 LL;
| ^~~~~~~
| __int64_t
a.cc:7:1: error: 'LL' does not name a type; did you mean 'NULL'?
7 | LL inf;
| ^~
| NULL
a.cc:11:24: error: 'LL' does not name a type; did you mean 'NULL'?
11 | int u,v,next, pre; LL f;
| ^~
| NULL
a.cc: In function 'void BFS()':
a.cc:41:21: error: 'struct edge' has no member named 'f'
41 | if(e[j].f==0||d[e[j].u]<N)
| ^
a.cc: At global scope:
a.cc:49:1: error: 'LL' does not name a type; did you mean 'NULL'?
49 | LL Augment()
| ^~
| NULL
a.cc: In function 'int Retreat(int&)':
a.cc:69:17: error: 'struct edge' has no member named 'f'
69 | if(e[j].f>0&&d[e[j].v]<mind)
| ^
a.cc: At global scope:
a.cc:80:1: error: 'LL' does not name a type; did you mean 'NULL'?
80 | LL maxflow()
| ^~
| NULL
a.cc:115:26: error: 'LL' has not been declared
115 | void addedge(int a,int b,LL c)
| ^~
a.cc: In function 'void addedge(int, int, int)':
a.cc:117:16: error: 'struct edge' has no member named 'f'
117 | e[num].f=c;e[num].u=a; e[num].v=b;
| ^
a.cc:122:34: error: 'struct edge' has no member named 'f'
122 | e[num].u=b;e[num].v=a;e[num].f=0;
| ^
a.cc: At global scope:
a.cc:127:1: error: 'LL' does not name a type; did you mean 'NULL'?
127 | LL g[maxn][maxn];
| ^~
| NULL
a.cc:128:8: error: 'LL' does not name a type; did you mean 'NULL'?
128 | inline LL min(LL a, LL b) { return a<b?a:b; }
| ^~
| NULL
a.cc: In function 'int main()':
a.cc:131:14: error: 'LL' was not declared in this scope
131 | int a,b; LL c;
| ^~
a.cc:136:24: error: 'g' was not declared in this scope
136 | memset(g, 0, sizeof(g));
| ^
a.cc:137:19: error: expected ';' before 'ans'
137 | LL ans=0;
| ^~~~
| ;
a.cc:140:54: error: 'c' was not declared in this scope
140 | scanf("%d %d %lld", &a, &b, &c);
| ^
a.cc:144:30: error: 'ans' was not declared in this scope
144 | if (c>0) ans+=c; else ans-=c;
| ^~~
a.cc:144:43: error: 'ans' was not declared in this scope
144 | if (c>0) ans+=c; else ans-=c;
| ^~~
a.cc:146:17: error: 'inf' was not declared in this scope; did you mean 'int'?
146 | inf=ans;
| ^~~
| int
a.cc:146:21: error: 'ans' was not declared in this scope
146 | inf=ans;
| ^~~
a.cc:152:27: error: expected ';' before 'tmp'
152 | LL tmp=0;
| ^~~~
| ;
a.cc:157:48: error: 'tmp' was not declared in this scope
157 | if (g[j][k]<0) tmp+=g[j][k];
| ^~~
a.cc:160:38: error: 'maxflow' was not declared in this scope
160 | ans=min(ans, maxflow()+tmp);
| ^~~~~~~
a.cc:160:48: error: 'tmp' was not declared in this scope
160 | ans=min(ans, maxflow()+tmp);
| ^~~
a.cc:160:29: error: 'min' was not declared in this scope; did you mean 'main'?
160 | ans=min(ans, maxflow()+tmp);
| ^~~
| main
|
s689607293 | p00650 | C++ | #include <iostream>
#include <sstream>
#include <cstdlib>
#include <cmath>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdio>
#include <numeric>
#include <bitset>
#include <stack>
using namespace std;
typedef struct
{
int to, cap, rev;
} Edge;
const int MAX_N = 100, INF = 1 << 30;
bool used[MAX_N];
void add_edge(vector<vector<Edge> >& G, int from, int to, int cap)
{
Edge e1 = { to, cap, G[to].size() };
G[from].push_back(e1);
Edge e2 = { from, 0, G[from].size()-1 };
G[to].push_back(e2);
}
int solve(vector<vector<Edge> >& G, int s, int t, int f)
{
if (s == t)
return f;
used[s] = true;
for (unsigned int i = 0; i < G[s].size(); ++i) {
Edge& e = G[s][i];
if (!used[e.to] && e.cap > 0) {
int d = solve(G, e.to, t, min(e.cap, f));
if (d > 0) {
e.cap -= d;
G[e.to][e.rev].cap += d;
return d;
}
}
}
return 0;
}
int max_flow(vector<vector<Edge> > G, int s, int t)
{
int flow = 0;
for ( ; ; ) {
memset(used, 0, sizeof(used));
int f = solve(G, s, t, INF);
if (f == 0)
return flow;
flow += f;
}
}
int main()
{
int n, m;
while (~scanf("%d %d", &n, &m)) {
if (n == 0 && m == 0)
break;
vector<vector<Edge> > G(n);
int rev = 0;
for (int i = 0; i < m; ++i) {
int x, y, c;
scanf("%d %d %d", &x, &y, &c);
if (c < 0) {
rev += c;
c = 0;
}
add_edge(G, x, y, c);
}
int ans = INF;
for (int i = 0; i < n; ++i) {
for (int j = i+1; j < n; ++j) {
ans = min(ans, max_flow(G, i, j));
}
}
printf("%d\n", ans+rev);
}
return 0;
} | a.cc: In function 'void add_edge(std::vector<std::vector<Edge> >&, int, int, int)':
a.cc:28:34: warning: narrowing conversion of '(&(& G)->std::vector<std::vector<Edge> >::operator[](((std::vector<std::vector<Edge> >::size_type)to)))->std::vector<Edge>::size()' from 'std::vector<Edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
28 | Edge e1 = { to, cap, G[to].size() };
| ~~~~~~~~~~^~
a.cc:30:38: warning: narrowing conversion of '((&(& G)->std::vector<std::vector<Edge> >::operator[](((std::vector<std::vector<Edge> >::size_type)from)))->std::vector<Edge>::size() - 1)' from 'std::vector<Edge>::size_type' {aka 'long unsigned int'} to 'int' [-Wnarrowing]
30 | Edge e2 = { from, 0, G[from].size()-1 };
| ~~~~~~~~~~~~~~^~
a.cc: In function 'int max_flow(std::vector<std::vector<Edge> >, int, int)':
a.cc:58:5: error: 'memset' was not declared in this scope
58 | memset(used, 0, sizeof(used));
| ^~~~~~
a.cc:16:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
15 | #include <stack>
+++ |+#include <cstring>
16 | using namespace std;
|
s167503732 | p00650 | C++ | /*
* sy.cpp
*
* Created on: 2012-10-7
* Author: Administrator
*/
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
using namespace std;
typedef long long ll;
#define zero(a) memset(a,0,sizeof(a))
const double pi = acos(-1.0);
const int inf = 0x7FFFFFFF;
const double eps = 1e-8;
int n, m;
const int N = 1005;
const int M = 10005;
int k[101][101];
bool f[101];
int tot;
struct edge {
int next, v;
} e[M];
int head[N], index;
void init() {
zero(head);
index = 1;
}
inline void add(int u, int v) {
e[index].v = v;
e[index].next = head[u];
head[u] = index++;
}
void bfs(int x) {
f[x] = 1;
tot++;
int i, j;
queue<int> q;
q.push(x);
while (!q.empty()) {
int tmp = q.front();
q.pop();
for (i = head[tmp]; i; i = e[i].next) {
if (!f[e[i].v]) {
f[e[i].v] = 1;
tot++;
q.push(e[i].v);
}
}
}
}
bool g[101],ac[101];
void jud(int x) {
zero(f);
zero(ac);
f[x] = 1;
queue<int> q;
q.push(x);
int i,j;
while (!q.empty()) {
int tmp = q.front();
q.pop();
for (i = head[tmp]; i; i = e[i].next) {
if(tmp == x){
ac[e[i].v] = 1;
}
if(e[i].v == x && ac[tmp] == 0){
g[x] = 1;return;
}
if (!f[e[i].v]) {
f[e[i].v] = 1;
q.push(e[i].v);
}
}
}
}
int m1[10000],m2[10000],t1,t2;
int main() {
int i, j, a, b, c, ans;
while (cin >> n >> m && (n || m)) {
for(i = 1;i <= n;i ++){
for(j = 1;j <= n; j++){
k[i][j] = -inf;
}
}
zero(f);
init();
ans = 0;
for (i = 0; i < m; i++) {
cin >> a >> b >> c;
a++;
b++;
if (c <= 0) {
ans += c;
continue;
}
k[a][b] = max(0, k[a][b]);
k[b][a] = max(0, k[b][a]);
k[a][b] += c;
k[b][a] += c;
add(a, b);
add(b, a);
}
tot = 0;
bfs(1);
if (tot != n) {
cout << ans << endl;
continue;
}zero(g);
for (i = 1; i <= n; i++) {
jud(i);
}
t1 = t2 = 0;
for(i = 1;i <= n;i ++){
for(j = i+1;j <= n; j++){
if(k[i][j] == -inf) continue;
if(g[i]&&g[j]){
m1[t1++] = k[i][j];
}
else
m2[t2++] = k[i][j];
}
}
sort(m1,m1+t1);
sort(m2,m2+t2);
if(t1 > 1){
cout<<ans + min(m1[0]+m1[1],m2[0])<<endl;
}
else
cout<<ans + m2[0]<<endl;
}
} | a.cc:33:14: error: 'int index' redeclared as different kind of entity
33 | int head[N], index;
| ^~~~~
In file included from /usr/include/string.h:462,
from /usr/include/c++/14/cstring:43,
from a.cc:10:
/usr/include/strings.h:50:20: note: previous declaration 'const char* index(const char*, int)'
50 | extern const char *index (const char *__s, int __c)
| ^~~~~
a.cc: In function 'void init()':
a.cc:36:17: error: overloaded function with no contextual type information
36 | index = 1;
| ^
a.cc: In function 'void add(int, int)':
a.cc:39:10: error: invalid types 'edge [10005][<unresolved overloaded function type>]' for array subscript
39 | e[index].v = v;
| ^
a.cc:40:10: error: invalid types 'edge [10005][<unresolved overloaded function type>]' for array subscript
40 | e[index].next = head[u];
| ^
a.cc:41:24: error: no post-increment operator for type
41 | head[u] = index++;
| ^~
|
s781648255 | p00650 | C++ | #include <iostream>
#include <string>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <stack>
#include <list>
#include <algorithm>
using namespace std;
#define typec __int64
#define V 111
//const typec inf = 0x3f3f3f3f;
const typec maxw = 111;
typec g[V][V], w[V];
typec a[V], v[V], na[V];
typec Stoer_Wagner(int n)
{
int i, j, pv, zj;
typec best = maxw * n * n;
for (i = 0; i < n; i++) v[i] = i; // vertex: 0 ~ n-1
while (n > 1)
{
for (a[v[0]] = 1, i = 1; i < n; i++)
{
a[v[i]] = 0;
na[i - 1] = i;
w[i] = g[v[0]][v[i]];
}
for (pv = v[0], i = 1; i < n; i++ )
{
for (zj = -1, j = 1; j < n; j++ )
if (!a[v[j]] && (zj < 0 || w[j] > w[zj]))
zj = j;
a[v[zj]] = 1;
if (i == n - 1)
{
if (best > w[zj]) best = w[zj];
for (i = 0; i < n; i++)
g[v[i]][pv] = g[pv][v[i]] += g[v[zj]][v[i]];
v[zj] = v[--n];
break;
}
pv = v[zj];
for (j = 1; j < n; j++)
if(!a[v[j]])
w[j] += g[v[zj]][v[j]];
}
}
return best;
}
int main()
{
//freopen("G:\\in.txt","r",stdin);
int n, m, u, v, w;
while(scanf("%d%d", &n, &m) != EOF,n+m)
{
memset(g, 0, sizeof(g));
while(m --)
{
scanf("%d%d%d", &u, &v, &w);
g[u][v] += w;
g[v][u] += w;
}
printf("%lld\n", Stoer_Wagner(n));
}
return 0;
} | a.cc:15:15: error: '__int64' does not name a type; did you mean '__int64_t'?
15 | #define typec __int64
| ^~~~~~~
a.cc:18:7: note: in expansion of macro 'typec'
18 | const typec maxw = 111;
| ^~~~~
a.cc:15:15: error: '__int64' does not name a type; did you mean '__int64_t'?
15 | #define typec __int64
| ^~~~~~~
a.cc:19:1: note: in expansion of macro 'typec'
19 | typec g[V][V], w[V];
| ^~~~~
a.cc:15:15: error: '__int64' does not name a type; did you mean '__int64_t'?
15 | #define typec __int64
| ^~~~~~~
a.cc:20:1: note: in expansion of macro 'typec'
20 | typec a[V], v[V], na[V];
| ^~~~~
a.cc:15:15: error: '__int64' does not name a type; did you mean '__int64_t'?
15 | #define typec __int64
| ^~~~~~~
a.cc:22:1: note: in expansion of macro 'typec'
22 | typec Stoer_Wagner(int n)
| ^~~~~
a.cc: In function 'int main()':
a.cc:66:16: error: 'g' was not declared in this scope
66 | memset(g, 0, sizeof(g));
| ^
a.cc:73:26: error: 'Stoer_Wagner' was not declared in this scope
73 | printf("%lld\n", Stoer_Wagner(n));
| ^~~~~~~~~~~~
|
s272841233 | p00651 | C++ | cat 1066.cpp
#include <set>
#include <cstdio>
#include <algorithm>
#include <cmath>
#define REP(i,n) for(int i=0; i<(int)(n); i++)
inline int getInt(){ int s; scanf("%d", &s); return s; }
#include <complex>
using namespace std;
typedef complex<double> P;
const double EPS = 1e-8;
const double PI = acos(0) * 2;
struct cmpTheta{
const P base;
cmpTheta(P p) : base(p) {}
bool operator () (const P &p1, const P &p2) const{
P ang1 = (p1 - base) / abs(p1 - base);
P ang2 = (p2 - base) / abs(p2 - base);
return (ang1 / ang2).imag() < 0;
}
};
int ccw(P p0, P p1, P p2){
P d1 = p1-p0;
P d2 = p2-p0;
double dx1 = d1.real(), dx2 = d2.real();
double dy1 = d1.imag(), dy2 = d2.imag();
if(dx1*dy2 > dy1*dx2) return 1;
if(dx1*dy2 < dy1*dx2) return -1;
if((dx1*dx2 < 0) || (dy1*dy2 < 0)) return -1;
if((dx1*dx1+dy1*dy1) < (dx2*dx2+dy2*dy2)) return 1;
return 0;
}
#define PP(p, i, n) (p[((i)==-1 ? (n)-1 : (i))])
int grahamscan(P *p, int N){
int min, M, i;
for(min=0, i=1; i<=N; i++)
if(p[i].imag() < p[min].imag())
min=i;
for(i=1; i<=N; i++)
if(p[i].imag() == p[min].imag())
if(p[i].real() > p[min].real())
min = i;
swap(p[min], p[0]);
sort(p+1, p+N, cmpTheta(p[0]));
for(M=2, i=3; i<=N; i++){
while(ccw(PP(p,M,N),PP(p,M-1,N),PP(p,i,N)) >= 0) M--;
M++; swap(p[i], p[M]);
}
return M;
}
int main(){
while(true){
int n = getInt();
int r = getInt();
int q = getInt();
P pos[30];
if(n + r + q == 0) break;
REP(i,n){
pos[i].real() = getInt();
pos[i].imag() = getInt();
}
int m = grahamscan(pos, n - 1) + 1;
int now = 0;
// printf("%d\n", m);
REP(i,n) if(std::abs(abs(pos[i]) - r) < EPS)
now = i;
double theta = arg(pos[now]);
REP(i,q){
int next = (now + 1) % m;
double dist = abs(pos[now] - pos[next]);
double c = (2 * r * r - dist * dist) / (2 * r * r);
theta -= acos(c);
while(theta < 0) theta += 2 * PI;
printf("%.6f %.6f\n", r * cos(theta), r * sin(theta));
now = next;
}
}
return 0;
} | a.cc:1:1: error: 'cat' does not name a type
1 | cat 1066.cpp
| ^~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/bits/stl_tree.h:63,
from /usr/include/c++/14/set:62,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^
/usr/include/c++/14/type_traits:1866:14: error: 'size_t' has not been declared
1866 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1867:23: error: '_Sz' was not declared in this scope
1867 | struct __select<_Sz, _List<_Uint, _UInts...>, false>
| ^~~
/usr/include/c++/14/type_traits:1867:58: error: template argument 1 is invalid
1867 | struct __select< |
s156343297 | p00652 | C++ | //import java.util.Scanner;
import java.io.*;
class Rmq{
int segt[] = new int[(1<<21)*2];
public int inp[] =new int[(1<<21)];
int MAX_VALUE=2147483647;
int min(int a,int b){return a<b?a:b;}
int max(int a,int b){return a>b?a:b;}
void update(int value,int pos,int n){
int index=n-1+pos;
segt[index]=value;//[pos,pos]
while(index>0){
index=(index-1)/2;
segt[index]=min(segt[index*2+1],segt[index*2+2]);
}
}
int query(int l,int r,int now,int ql,int qr){
if (l == ql && r == qr){
return segt[now];
}
int midr=(l+r)/2,midl=midr+1;
int ret=MAX_VALUE;
if (ql <= midr)ret=min(ret,query(l,midr,now*2+1,ql,min(qr,midr)));
if (midl <= qr)ret=min(ret,query(midl,r,now*2+2,max(midl,ql),qr));
return ret;
}
public void init(int r,int c,int lim){
boolean isrowmajor=r<=c;
for(int i=0;i<lim;i++){
segt[i]=MAX_VALUE;
}
if (isrowmajor){
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
update(inp[i*c+j],i*c+j,lim);
}
}
}else {
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
update(inp[i+j*r],i+j*r,lim);
}
}
}
}
int searchmin(int r1,int c1,int r2,int c2,int r,int c,int lim){
boolean isrowmajor = r<=c;
int ret=MAX_VALUE;
lim--;
if (isrowmajor){
for(int i=r1;i<=r2;i++){
ret=min(ret,query(0,lim,0,i*c+c1,i*c+c2));
}
}else {
for(int j=c1;j<=c2;j++){
ret=min(ret,query(0,lim,0,j*r+r1,j*r+r2));
}
}
return ret;
}
}
class Main{
void run(){
Scanner in = new Scanner();
//System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
int r,c,q;
Rmq rmq=new Rmq();
while(true){
r=in.nextInt();
c=in.nextInt();
q=in.nextInt();
if (r == 0)break;
int lim=1;
boolean isrowmajor = r<=c;
while(true){
if (lim >= r*c)break;
lim*=2;
}
if (isrowmajor){
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
rmq.inp[i*c+j]=in.nextInt();
}
}
}else {
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
rmq.inp[i+j*r]=in.nextInt();
}
}
}
rmq.init(r,c,lim);
for(int i=0;i<q;i++){
int r1,r2,c1,c2;
r1=in.nextInt();
c1=in.nextInt();
r2=in.nextInt();
c2=in.nextInt();
System.out.println(rmq.searchmin(r1,c1,r2,c2,r,c,lim));
}
}
}
public static void main(String args[]){
Main a = new Main();
a.run();
}
}
class Scanner {
int nextInt() {
try {
int c = System.in.read();
if (c == -1)
return c;
while (c != '-' && (c < '0' || '9' < c)) {
c = System.in.read();
if (c == -1)
return c;
}
if (c == '-')
return -nextInt();
int res = 0;
do {
res *= 10;
res += c - '0';
c = System.in.read();
} while ('0' <= c && c <= '9');
return res;
} catch (Exception e) {
return -1;
}
}
long nextLong() {
try {
int c = System.in.read();
if(c==-1)return -1;
while (c != '-' && (c < '0' || '9' < c)){
c = System.in.read();
if(c==-1)return -1;
}
if (c == '-')
return -nextLong();
long res = 0;
do {
res *= 10;
res += c - '0';
c = System.in.read();
} while ('0' <= c && c <= '9');
return res;
} catch (Exception e) {
return -1;
}
}
double nextDouble() {
return Double.parseDouble(next());
}
String next() {
try {
StringBuilder res = new StringBuilder("");
int c = System.in.read();
while (Character.isWhitespace(c))
c = System.in.read();
do {
res.append((char) c);
} while (!Character.isWhitespace(c = System.in.read()));
return res.toString();
} catch (Exception e) {
return null;
}
}
String nextLine() {
try {
StringBuilder res = new StringBuilder("");
int c = System.in.read();
while (c == '\r' || c == '\n')
c = System.in.read();
do {
res.append((char) c);
c = System.in.read();
} while (c != '\r' && c != '\n');
return res.toString();
} catch (Exception e) {
return null;
}
}
} | a.cc:2:1: error: 'import' does not name a type
2 | import java.io.*;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:11: error: expected ':' before 'int'
6 | public int inp[] =new int[(1<<21)];
| ^~~~
| :
a.cc:29:11: error: expected ':' before 'void'
29 | public void init(int r,int c,int lim){
| ^~~~~
| :
a.cc:5:9: error: flexible array member 'Rmq::segt' not at end of 'class Rmq'
5 | int segt[] = new int[(1<<21)*2];
| ^~~~
a.cc:64:2: error: expected ';' after class definition
64 | }
| ^
| ;
a.cc:5:9: error: initializer for flexible array member 'int Rmq::segt []'
5 | int segt[] = new int[(1<<21)*2];
| ^~~~
a.cc:6:16: error: initializer for flexible array member 'int Rmq::inp []'
6 | public int inp[] =new int[(1<<21)];
| ^~~
a.cc: In member function 'void Rmq::init(int, int, int)':
a.cc:30:9: error: 'boolean' was not declared in this scope; did you mean 'bool'?
30 | boolean isrowmajor=r<=c;
| ^~~~~~~
| bool
a.cc:34:13: error: 'isrowmajor' was not declared in this scope
34 | if (isrowmajor){
| ^~~~~~~~~~
a.cc: In member function 'int Rmq::searchmin(int, int, int, int, int, int, int)':
a.cc:49:9: error: 'boolean' was not declared in this scope; did you mean 'bool'?
49 | boolean isrowmajor = r<=c;
| ^~~~~~~
| bool
a.cc:52:13: error: 'isrowmajor' was not declared in this scope
52 | if (isrowmajor){
| ^~~~~~~~~~
a.cc: At global scope:
a.cc:107:11: error: expected ':' before 'static'
107 | public static void main(String args[]){
| ^~~~~~~
| :
a.cc:107:29: error: 'String' has not been declared
107 | public static void main(String args[]){
| ^~~~~~
a.cc:111:2: error: expected ';' after class definition
111 | }
| ^
| ;
a.cc: In member function 'void Main::run()':
a.cc:68:9: error: 'Scanner' was not declared in this scope
68 | Scanner in = new Scanner();
| ^~~~~~~
a.cc:73:15: error: 'in' was not declared in this scope; did you mean 'int'?
73 | r=in.nextInt();
| ^~
| int
a.cc:78:13: error: 'boolean' was not declared in this scope; did you mean 'bool'?
78 | boolean isrowmajor = r<=c;
| ^~~~~~~
| bool
a.cc:83:17: error: 'isrowmajor' was not declared in this scope
83 | if (isrowmajor){
| ^~~~~~~~~~
a.cc:103:17: error: 'System' was not declared in this scope
103 | System.out.println(rmq.searchmin(r1,c1,r2,c2,r,c,lim));
| ^~~~~~
a.cc: In static member function 'static void Main::main(int*)':
a.cc:108:18: error: conversion from 'Main*' to non-scalar type 'Main' requested
108 | Main a = new Main();
| ^~~~~~~~~~
a.cc: At global scope:
a.cc:165:5: error: 'String' does not name a type
165 | String next() {
| ^~~~~~
a.cc:180:5: error: 'String' does not name a type
180 | String nextLine() {
| ^~~~~~
a.cc:195:2: error: expected ';' after class definition
195 | }
| ^
| ;
a.cc: In member function 'int Scanner::nextInt()':
a.cc:117:21: error: 'System' was not declared in this scope
117 | int c = System.in.read();
| ^~~~~~
a.cc:134:18: error: 'Exception' does not name a type
134 | } catch (Exception e) {
| ^~~~~~~~~
a.cc: In member function 'long int Scanner::nextLong()':
a.cc:141:21: error: 'System' was not declared in this scope
141 | int c = System.in.read();
| ^~~~~~
a.cc:156:18: error: 'Exception' does not name a type
156 | } catch (Exception e) {
| ^~~~~~~~~
a.cc: In member function 'double Scanner::nextDouble()':
a.cc:162:16: error: 'Double' was not declared in this scope; did you mean 'double'?
162 | return Double.parseDouble(next());
| ^~~~~~
| double
a.cc:162:35: error: 'next' was not declared in this scope; did you mean 'nextInt'?
162 | return Double.parseDouble(next());
| ^~~~
| nextInt
|
s560439618 | p00652 | C++ | #include<stdio.h>
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;
const double eps=1e-8;
int sgn(double d)
{
if (d>eps) return 1;
if (d<-eps) return -1;
return 0;
}
struct point
{
double x,y;
point(double _x=0,double _y=0):x(_x),y(_y){}
void input()
{
scanf("%lf%lf",&x,&y);
}
double len()
{
return sqrt(x*x+y*y);
}
}p[30010];
point operator+(const point& p1,const point& p2)
{
return point(p1.x+p2.x,p1.y+p2.y);
}
point operator-(const point& p1,const point& p2)
{
return point(p1.x-p2.x,p1.y-p2.y);
}
double yy1[30010],yy2[30010];
double sum[30010];
int he[30010];
int n,m;
double s,w,h;
int a[30010];
bool check(double yy1,double yy2,point p)
{
double y=yy1+((yy2-yy1)/(double)w)*p.x;
return sgn(y-p.y)>=0;
}
int find_pos(point p)
{
int L=1,R=m;
while(L<R)
{
if (L==R-1) break;
int mid=(L+R)>>1;
if (check(yy1[mid],yy2[mid],p)) R=mid;
else L=mid;
}
if (check(yy1[L],yy2[L],p)) R=L;
return R;
}
int main()
{
while(scanf("%d%d%lf%lf%lf",&n,&m,&w,&h,&s))
{
if (n+m+w+h+s==0) break;
yy1[0]=0;yy2[0]=0;
for (int i=1;i<=m;i++)
{
scanf("%lf%lf",&yy1[i],&yy2[i]);
}
for (int i=0;i<n;i++)
p[i].input();
memset(a,0,sizeof(a));
for (int i=0;i<n;i++)
{
a[find_pos(p[i])]++;
}
memset(he,0,sizeof(he));
for (int i=1;i<=m;i++)
he[i]=he[i-1]+a[i];
for (int i=1;i<=m;i++)
sum[i]=(yy1[i]+yy2[i])*w/2.0;
double ts=0;
a[m+1]=0;
int tmp=0,ans=100000000;
for (int i=m;i>=1;i--)
{
tmp+=a[i+1];
ts=(2*h-yy1[i]-yy2[i])*w/2.0;
int L=1,R=i;
while(L<R)
{
if (L==R-1) break;
int mid=(L+R)>>1;
if (sgn(ts+sum[mid]-s)>=0) R=mid;
else L=mid;
}
if (sgn(ts+sum[L]-s)>=0) R=L;
ans=min(ans,he[R]+tmp);
}
printf("%d\n",ans);
}
return 0;
} | a.cc: In function 'int main()':
a.cc:76:12: error: 'memset' was not declared in this scope
76 | memset(a,0,sizeof(a));
| ^~~~~~
a.cc:5:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
4 | #include<algorithm>
+++ |+#include <cstring>
5 | using namespace std;
|
s349228198 | p00652 | C++ | #include<stdio.h>
#include<algorithm>
#include<cstring>
using namespace std;
const int INFI = 1 << 30;
const int V = 20;
int n;
int use[V], ans[V];
struct MAT
{
int lx,ly,rx,ry,id;
void rd()
{
scanf("%d%d%d%d",&lx,&ly,&rx,&ry);
}
bool operator <(const MAT &a)const
{
return lx < a.lx || (lx == a.lx && ly < a.ly);
}
}mat[V];
int main()
{
bool first = true;
while (1)
{
scanf("%d",&n);
if (n == 0) break;
for (int i=0;i<n;i++)
{
mat[i].rd();
mat[i].id = i;
}
sort(mat,mat+n);
memset(use,0,sizeof(use));
int now = 0;
while (1)
{
if (c != -1)
{
int topx = -INFI, topy = INFI, c = -1;
for (int j=0;j<n;j++)
if (!use[j] && (mat[j].lx > topx || (mat[j].lx == topx && mat[j].ly < topy)) )
{
topx = mat[j].lx;
topy = mat[j].ly;
c = j;
break;
}
printf("c is %d %d\n",mat[c].id,mat[c].ry);
if (c != -1)
use[c] = ++now;
else break;
int bx = mat[c].rx;
int by = mat[c].ry;
bool find;
do
{
find = false;
for (int k=0;k<n;k++)
if (mat[k].lx == bx && mat[k].ry == by)
{
find = true;
bx = mat[k].rx;
}
}while (find);
int get = -1;
for (int k=0;k<n;k++)
if (!use[k] && mat[k].lx <= bx && mat[k].ly >= mat[c].ry)
{
//printf("color %d\n",mat[k].id);
use[k] = ++now;
get = k;
break;
}
//if (get != -1) c =
}
if (!first) printf("\n");
first = false;
for (int i=0;i<n;i++) ans[ mat[i].id ] = use[i];
for (int i=0;i<n;i++)
printf("%d\n",ans[i]);
}
} | a.cc: In function 'int main()':
a.cc:42:29: error: 'c' was not declared in this scope
42 | if (c != -1)
| ^
a.cc:44:56: error: redeclaration of 'int c'
44 | int topx = -INFI, topy = INFI, c = -1;
| ^
a.cc:42:29: note: '<typeprefixerror>c' previously declared here
42 | if (c != -1)
| ^
a.cc:90:2: error: expected '}' at end of input
90 | }
| ^
a.cc:25:1: note: to match this '{'
25 | {
| ^
|
s951307040 | p00653 | C | #include <cstdio>
#include <cstring>
#include <climits>
#include <algorithm>
#include <vector>
using namespace std;
int n, dat[(1 << 21) - 1];
void init(int size)
{
int i;
n = 1;
while (n < size){
n *= 2;
}
for (i = 0; i < 2 * n - 1; i++){
dat[i] = INT_MAX;
}
}
void update(int k, int x)
{
k += n - 1;
dat[k] = x;
while (k > 0){
k = (k - 1) / 2;
dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
}
}
int x1, x2, y1, y2;
int w, h, q;
int query(int a, int b, int k, int l, int r)
{
int vl, vr;
if (r <= a || b <= l){
return (INT_MAX);
}
if (a <= l && r <= b){
return (dat[k]);
}
else {
vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
return (min(vl, vr));
}
}
int main(void)
{
int t;
int i, j;
int ans;
while (1){
scanf("%d%d%d", &h, &w, &q);
if (w + h + q == 0){
break;
}
init(w * h);
for (i = 0; i < h; i++){
for (j = 0; j < w; j++){
scanf("%d", &t);
update(i * w + j, t);
}
}
for (j = 0; j < q; j++){
scanf("%d%d%d%d", &y1, &x1, &y2, &x2);
ans = INT_MAX;
if (x1 == 0 && x2 == w - 1){
printf("%d\n", query(y1 * w + x1, y2 * w + x2 + 1, 0, 0, n));
}
else {
for (int k = y1; k <= y2; k++){
ans = min(ans, query(y1 * w + x1, y2 * w + x2 + 1, 0, 0, n));
}
printf("%d\n", ans);
}
}
}
return (0);
} | main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s415251052 | p00653 | C | #include <cstdio>
#include <cstring>
#include <climits>
#include <algorithm>
#include <vector>
using namespace std;
int n, dat[(1 << 21) - 1];
void init(int size)
{
int i;
n = 1;
while (n < size){
n *= 2;
}
for (i = 0; i < 2 * n - 1; i++){
dat[i] = INT_MAX;
}
}
void update(int k, int x)
{
k += n - 1;
dat[k] = x;
while (k > 0){
k = (k - 1) / 2;
dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
}
}
int x1, x2, y1, y2;
int w, h, q;
int query(int a, int b, int k, int l, int r)
{
int vl, vr;
if (r <= a || b <= l){
return (INT_MAX);
}
if (a <= l && r <= b){
return (dat[k]);
}
else {
vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
return (min(vl, vr));
}
}
int main(void)
{
int t;
int i, j;
int ans;
while (1){
scanf("%d%d%d", &h, &w, &q);
if (w + h + q == 0){
break;
}
init(w * h);
if (h >= w){
for (i = 0; i < h; i++){
for (j = 0; j < w; j++){
scanf("%d", &t);
update(i * w + j, t);
}
}
}
else {
for (i = 0; i < h; i++){
for (j = 0; j < w; j++){
scanf("%d", &t);
update(i + j * h, t);
}
}
}
for (j = 0; j < q; j++){
scanf("%d%d%d%d", &y1, &x1, &y2, &x2);
ans = INT_MAX;
if (x1 == 0 && x2 == w - 1){
printf("%d\n", query(y1 * w + x1, y2 * w + x2 + 1, 0, 0, n));
}
else {
if (h >= w){
for (int k = y1; k <= y2; k++){
ans = min(ans, query(k * w + x1, k * w + x2 + 1, 0, 0, n));
}
}
else {
for (int k = x1; k <= x2; k++){
ans = min(ans, query(k * h + y1, k * h + y2 + 1, 0, 0, n));
}
}
printf("%d\n", ans);
}
}
}
return (0);
} | main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s554696149 | p00653 | C++ | #include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdlib>
#include <climits>
using namespace std;
#define ALL(c) c.begin(),c.end()
#define RALL(c) c.rbegin(),c.rend()
#define REP(i,x,y) for(int i=(x);i<(y);++i)
#define MP(a,b) make_pair((a),(b))
#define F_ first
#define S_ second
typedef long long int lli;
typedef pair<int,int> Pi;
const int INF=100000000;
const long long int INF_=100000000000000000;
lli Cmin(const lli a,const lli b){
if(a<b) return a;
else return b;
}
class SegmentTree{
private:
static const lli MAX_N=1<<31;
lli dat[2*MAX_N-1];
public:
int n;
void Init(int n_){
n=1;
while(n<n_) n*=2;
for(int i=0; i<2*n-1; ++i) dat[i]=INF_;
}
void Update(int k,lli a){
k+=n-1;
dat[k]=a;
while(k>0){
k=(k-1)/2;
dat[k]=Cmin(dat[k*2+1],dat[k*2+2]);
}
}
lli Query(int a,int b,int k,int l,int r){
if(r<=a||b<=l) return INF_;
if(a<=l&&r<=b) return dat[k];
else {
lli vl=Query(a,b,k*2+1,l,(l+r)/2);
lli vr=Query(a,b,k*2+2,(l+r)/2,r);
return min(vl,vr);
}
}
int GetData(const int k){
return dat[k];
}
};
int Serialize(const int y,const int x,const int w){
return x+y*w;
}
int solve(){
int R,C,Q;
cin >> R >> C >> Q;
if(R==0&&C==0&&Q==0) return 0;
SegmentTree st;
st.Init(R*C);
REP(y,0,R) REP(x,0,C){
lli tmp;
cin >> tmp;
st.Update(Serialize(y,x,C),tmp);
}
/*
REP(i,0,R*C+st.n-1) cout << st.GetData(i) << endl;
cout << endl;
*/
REP(i,0,Q){
int r[2],c[2];
REP(j,0,2) cin >> r[j] >> c[j];
lli ans=INF_;
REP(y,r[0],r[1]+1) ans=Cmin(ans,st.Query(Serialize(y,c[0],C),Serialize(y,c[1]+1,C),0,0,st.n));
cout << ans << endl;
}
//REP(i,0,R*C) cout << st.GetData(i) << endl;
//REP(y,0,R) REP(x,0,C) cout << st.GetData(Serialize(y,x,C)) << endl;
return 1;
}
int main(){
while(solve());
return 0;
} | a.cc:39:26: error: narrowing conversion of '-4294967297' from 'long long int' to 'long unsigned int' [-Wnarrowing]
39 | lli dat[2*MAX_N-1];
| ^
a.cc:39:24: error: size '-4294967297' of array 'dat' is negative
39 | lli dat[2*MAX_N-1];
| ~~~~~~~^~
|
s681006010 | p00653 | C++ | // library
#include<vector>
#include<algorithm>
// constant
const int INF = 1e9;
// class
class SegmentTree {
public:
SegmentTree(int x, int y);
void update(int x, int y, int value);
int find(int x1, int y1, int x2, int y2) const;
void print();
private:
void update(int index, int a1, int b1, int a2, int b2, int x, int y, int value);
int find(int index, int a1, int b1, int a2, int b2, int x1, int y1, int x2, int y2) const;
int parent(int index) const;
int upper_left(int index) const;
int upper_right(int index) const;
int lower_left(int index) const;
int lower_right(int index) const;
std::vector<int> node_;
int height_;
int width_;
int size_;
};
// constructor
SegmentTree::SegmentTree(int x, int y) : width_(x), height_(y) {
size_ = 1;
for(int i = 1; i <= std::max(x, y); i <<= 1) size_ <<= 2;
node_.assign(size_, INF);
}
// set value on (x, y)
void SegmentTree::update(int x, int y, int value) {
update(0, 0, 0, width_ - 1, height_ - 1, x, y, value);
}
void SegmentTree::update(int index, int a1, int b1, int a2, int b2, int x, int y, int value) {
if(size_ <= index) return;
if(x < a1 || a2 < x) return;
if(y < b1 || b2 < y) return;
if(a1 == x && x == a2 && b1 == y && y == b2) {
node_[index] = value;
while(index) {
node_[parent(index)] = std::min(node_[parent(index)], node_[index]);
index = parent(index);
}
} else {
int a = (a1 + a2) >> 1;
int b = (b1 + b2) >> 1;
update(upper_left(index), a1, b1, a, b, x, y, value);
update(upper_right(index), a + 1, b1, a2, b, x, y, value);
update(lower_left(index), a1, b + 1, a, b2, x, y, value);
update(lower_right(index), a + 1, b + 1, a2, b2, x, y, value);
}
}
// find the minimum value in (x1, y1)-(x2, y2)
int SegmentTree::find(int x1, int y1, int x2, int y2) const {
return find(0, 0, 0, width_ - 1, height_ - 1, x1, y1, x2, y2);
}
int SegmentTree::find(int index, int a1, int b1, int a2, int b2, int x1, int y1, int x2, int y2) const {
// for(int i=0;i<(index-1)>>2;++i)cout<<" ";
// cout<<"*"<<index<<"* "<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
if(size_ <= index) return INF;
if(x2 < a1 || a2 < x1) return INF;
if(y2 < b1 || b2 < y1) return INF;
if(x1 <= a1 && a2 <= x2 && y1 <= b1 && b2 <= y2) return node_[index];
int a = (a1 + a2) >> 1;
int b = (b1 + b2) >> 1;
int ul = find(upper_left(index), a1, b1, a, b, x1, y1, x2, y2);
int ur = find(upper_right(index), a + 1, b1, a2, b, x1, y1, x2, y2);
int ll = find(lower_left(index), a1, b + 1, a, b2, x1, y1, x2, y2);
int lr = find(lower_right(index), a + 1, b + 1, a2, b2, x1, y1, x2, y2);
return std::min({ul, ur, ll, lr});
}
// debug
void SegmentTree::print() {
for(auto i: node_) cout<<" "<<i;cout<<endl;
}
// position
int SegmentTree::parent(int index) const {return (index - 1) >> 2;}
int SegmentTree::upper_left(int index) const {return (index << 2) + 1;}
int SegmentTree::upper_right(int index) const {return (index << 2) + 2;}
int SegmentTree::lower_left(int index) const {return (index << 2) + 3;}
int SegmentTree::lower_right(int index) const {return (index << 2) + 4;}
#include<bits/stdc++.h>
using namespace std;
int main() {
int r, c, q;
while(cin >> r >> c >> q, r | c | q) {
SegmentTree tree(c, r);
for(int y = 0; y < r; ++y) for(int x = 0; x < c; ++x) {
int grid;
cin >> grid;
tree.update(x, y, grid);
}
// tree.print();
for(int i = 0; i < q; ++i) {
int r1, c1, r2, c2;
cin >> r1 >> c1 >> r2 >> c2;
cout << tree.find(c1, r1, c2, r2) << endl;
}
}
} | a.cc: In member function 'void SegmentTree::print()':
a.cc:76:22: error: 'cout' was not declared in this scope
76 | for(auto i: node_) cout<<" "<<i;cout<<endl;
| ^~~~
a.cc:76:35: error: 'cout' was not declared in this scope
76 | for(auto i: node_) cout<<" "<<i;cout<<endl;
| ^~~~
a.cc:76:41: error: 'endl' was not declared in this scope
76 | for(auto i: node_) cout<<" "<<i;cout<<endl;
| ^~~~
|
s733775842 | p00653 | C++ | #include<bits/stdc++.h>
using namespace std;
// library
#include<vector>
#include<climitts>
#include<algorithm>
// constant
const int INF = INT_MAX;
// class
class SegmentTree {
public:
SegmentTree(int x, int y);
void update(int x, int y, int value);
int find(int x1, int y1, int x2, int y2) const;
void print();
private:
void update(int index, int a1, int b1, int a2, int b2, int x, int y, int value);
int find(int index, int a1, int b1, int a2, int b2, int x1, int y1, int x2, int y2) const;
int parent(int index) const;
int upper_left(int index) const;
int upper_right(int index) const;
int lower_left(int index) const;
int lower_right(int index) const;
std::vector<int> node_;
int height_;
int width_;
int size_;
};
// constructor
SegmentTree::SegmentTree(int x, int y) : width_(x), height_(y) {
size_ = 1;
for(int i = 1; i < std::max(x, y); i <<= 1) size_ <<= 2;
node_.assign(size_, INF);
}
// set value on (x, y)
void SegmentTree::update(int x, int y, int value) {
update(0, 0, 0, width_ - 1, height_ - 1, x, y, value);
}
void SegmentTree::update(int index, int a1, int b1, int a2, int b2, int x, int y, int value) {
if(size_ <= index) return;
if(x < a1 || a2 < x) return;
if(y < b1 || b2 < y) return;
if(a1 == x && x == a2 && b1 == y && y == b2) {
node_[index] = value;
while(index) {
node_[parent(index)] = std::min(node_[parent(index)], node_[index]);
index = parent(index);
}
} else {
int a = (a1 + a2) >> 1;
int b = (b1 + b2) >> 1;
update(upper_left(index), a1, b1, a, b, x, y, value);
update(upper_right(index), a + 1, b1, a2, b, x, y, value);
update(lower_left(index), a1, b + 1, a, b2, x, y, value);
update(lower_right(index), a + 1, b + 1, a2, b2, x, y, value);
}
}
// find the minimum value in (x1, y1)-(x2, y2)
int SegmentTree::find(int x1, int y1, int x2, int y2) const {
return find(0, 0, 0, width_ - 1, height_ - 1, x1, y1, x2, y2);
}
int SegmentTree::find(int index, int a1, int b1, int a2, int b2, int x1, int y1, int x2, int y2) const {
// for(int i=0;i<(index-1)>>2;++i)cout<<" ";
// cout<<"*"<<index<<"* "<<a1<<" "<<b1<<" "<<a2<<" "<<b2<<endl;
if(size_ <= index) return INF;
if(x2 < a1 || a2 < x1) return INF;
if(y2 < b1 || b2 < y1) return INF;
if(x1 <= a1 && a2 <= x2 && y1 <= b1 && b2 <= y2) return node_[index];
int a = (a1 + a2) >> 1;
int b = (b1 + b2) >> 1;
int ul = find(upper_left(index), a1, b1, a, b, x1, y1, x2, y2);
int ur = find(upper_right(index), a + 1, b1, a2, b, x1, y1, x2, y2);
int ll = find(lower_left(index), a1, b + 1, a, b2, x1, y1, x2, y2);
int lr = find(lower_right(index), a + 1, b + 1, a2, b2, x1, y1, x2, y2);
return std::min({ul, ur, ll, lr});
}
// debug
void SegmentTree::print() {
for(auto i: node_) cout<<" "<<i;cout<<endl;
}
// position
int SegmentTree::parent(int index) const {return (index - 1) >> 2;}
int SegmentTree::upper_left(int index) const {return (index << 2) + 1;}
int SegmentTree::upper_right(int index) const {return (index << 2) + 2;}
int SegmentTree::lower_left(int index) const {return (index << 2) + 3;}
int SegmentTree::lower_right(int index) const {return (index << 2) + 4;}
#include<bits/stdc++.h>
using namespace std;
int main() {
int r, c, q;
while(cin >> r >> c >> q, r | c | q) {
SegmentTree tree(c, r);
for(int y = 0; y < r; ++y) for(int x = 0; x < c; ++x) {
int grid;
cin >> grid;
tree.update(x, y, grid);
}
// tree.print();
for(int i = 0; i < q; ++i) {
int r1, c1, r2, c2;
cin >> r1 >> c1 >> r2 >> c2;
cout << tree.find(c1, r1, c2, r2) << endl;
}
}
} | a.cc:6:9: fatal error: climitts: No such file or directory
6 | #include<climitts>
| ^~~~~~~~~~
compilation terminated.
|
s838781567 | p00653 | C++ | #include <bits/stdc++.h>
??
using namespace std;
??
#define INF ((1LL<<31)-1)
#define D 10
??
struct SegTree {
????????int segSize, realSegSize, nodeSize;
int sz;
int *seg;
????????void init(int n) {
????????????????realSegSize = n;
??
????????????????nodeSize = 0;
????????????????for (segSize = 1; segSize < n; segSize *= D) nodeSize += segSize;
??
sz = nodeSize+n;
seg = new int[sz];
for(int i = 0 ; i < sz ; i++) seg[i] = INF;
????????}
??
????????int get(int n) {
????????????????if (n < sz) return seg[n];
????????????????else return INF;
????????}
????????void set(int n, int v) {
????????????????if (n < sz) seg[n] = v;
????????}
??
????????void update(int pos, int val) {
????????????????int n = nodeSize + pos;
????????????????set(n, val);
????????????????while (n) {
????????????????????????n = (n-1)/D;
??
????????????????????????int r = INF;
????????????????????????for (int i = 0; i < D; ++i) {
????????????????????????????????r = min(r, seg[n*D+i+1]);
????????????????????????}
????????????????????????set(n, r);
????????????????}
????????}
????????int get(int n, int l, int r, int L, int R) {
//?????????? cout << n << " " << l << " " << r << endl;
????????????????if (L <= l && r <= R) return get(n);
????????????????else if (R <= l || r <= L) return INF;
????????????????else {
????????????????????????int ret = INF;
????????????????????????int prev = l;
????????????????????????for (int i = 0; i < D; ++i) {
????????????????????????????????int next = i == D-1 ? r : prev + (r-l)/D;
????????????????????????????????ret = min(ret, get(n*D+i+1, prev, next, L, R));
????????????????????????????????prev = next;
????????????????????????}
????????????????????????return ret;
????????????????}
????????}
????????int get(int L, int R) {
????????????????return get(0, 0, segSize, L, R);
????????}
??
????????~SegTree() {
delete seg;
????????}
};
??
struct Query {
????????int y1, x1, y2, x2;
};
??
int main() {
????????int H, W, Q;
????????while ( cin >> H >> W >> Q, H || W || Q ) {
????????????????vector< vector<int> > m(H, vector<int>(W, 0));
??
????????????????for (int y = 0; y < H; ++y) {
????????????????????????for (int x = 0; x < W; ++x) {
????????????????????????????????cin >> m[y][x];
????????????????????????}
????????????????}
??
????????????????bool isSegRow = H < W;
????????????????vector<SegTree*> seg;
??
????????????????if (isSegRow) {
????????????????????????seg.resize(H);
????????????????????????for (int y = 0; y < H; ++y) {
????????????????????????????????seg[y] = new SegTree();
seg[y]->init(W);
????????????????????????}
????????????????}
????????????????else {
????????????????????????seg.resize(W);
????????????????????????for (int x = 0; x < W; ++x) {
????????????????????????????????seg[x] = new SegTree();
seg[x]->init(H);
????????????????????????}
????????????????}
??
????????????????for (int y = 0; y < H; ++y) {
????????????????????????for (int x = 0; x < W; ++x) {
????????????????????????????????if (isSegRow) seg[y]->update(x, m[y][x]);
????????????????????????????????else seg[x]->update(y, m[y][x]);
????????????????????????}
????????????????}
??
????????????????for (int t = 0; t < Q; ++t) {
????????????????????????int y1, x1, y2, x2; cin >> y1 >> x1 >> y2 >> x2;
??
????????????????????????int ans = INF;
????????????????????????if (isSegRow) {
????????????????????????????????for (int y = y1; y <= y2; ++y) {
????????????????????????????????????????ans = min(ans, seg[y]->get(x1, x2+1));
????????????????????????????????}
????????????????????????}
????????????????????????else {
????????????????????????????????for (int x = x1; x <= x2; ++x) {
????????????????????????????????????????ans = min(ans, seg[x]->get(y1, y2+1));
????????????????????????????????}
????????????????????????}
????????????????????????cout << ans << endl;
????????????????}
for(int i = 0 ; i < seg.size() ; i++) delete seg[i];
????????}
} | a.cc:2:1: error: expected unqualified-id before '?' token
2 | ??
| ^
a.cc:4:1: error: expected unqualified-id before '?' token
4 | ??
| ^
a.cc:67:1: error: expected unqualified-id before '?' token
67 | ??
| ^
a.cc:71:1: error: expected unqualified-id before '?' token
71 | ??
| ^
|
s298282614 | p00653 | C++ | #include <bits/stdc++.h>
??
using namespace std;
??
#define INF ((1LL<<31)-1)
#define D 10
??
struct SegTree {
????????int segSize, realSegSize, nodeSize;
int sz;
int *seg;
????????void init(int n) {
????????????????realSegSize = n;
??
????????????????nodeSize = 0;
????????????????for (segSize = 1; segSize < n; segSize *= D) nodeSize += segSize;
??
sz = nodeSize+n;
seg = new int[sz];
for(int i = 0 ; i < sz ; i++) seg[i] = INF;
????????}
??
????????int get(int n) {
????????????????if (n < sz) return seg[n];
????????????????else return INF;
????????}
????????void set(int n, int v) {
????????????????if (n < sz) seg[n] = v;
????????}
??
????????void update(int pos, int val) {
????????????????int n = nodeSize + pos;
????????????????set(n, val);
????????????????while (n) {
????????????????????????n = (n-1)/D;
??
????????????????????????int r = INF;
????????????????????????for (int i = 0; i < D; ++i) {
????????????????????????????????r = min(r, seg[n*D+i+1]);
????????????????????????}
????????????????????????set(n, r);
????????????????}
????????}
????????int get(int n, int l, int r, int L, int R) {
//?????????? cout << n << " " << l << " " << r << endl;
????????????????if (L <= l && r <= R) return get(n);
????????????????else if (R <= l || r <= L) return INF;
????????????????else {
????????????????????????int ret = INF;
????????????????????????int prev = l;
????????????????????????for (int i = 0; i < D; ++i) {
????????????????????????????????int next = i == D-1 ? r : prev + (r-l)/D;
????????????????????????????????ret = min(ret, get(n*D+i+1, prev, next, L, R));
????????????????????????????????prev = next;
????????????????????????}
????????????????????????return ret;
????????????????}
????????}
????????int get(int L, int R) {
????????????????return get(0, 0, segSize, L, R);
????????}
??
????????~SegTree() {
delete seg;
????????}
};
??
struct Query {
????????int y1, x1, y2, x2;
};
??
int main() {
????????int H, W, Q;
????????while ( cin >> H >> W >> Q, H || W || Q ) {
????????????????vector< vector<int> > m(H, vector<int>(W, 0));
??
????????????????for (int y = 0; y < H; ++y) {
????????????????????????for (int x = 0; x < W; ++x) {
????????????????????????????????cin >> m[y][x];
????????????????????????}
????????????????}
??
????????????????bool isSegRow = H < W;
????????????????vector<SegTree*> seg;
??
????????????????if (isSegRow) {
????????????????????????seg.resize(H);
????????????????????????for (int y = 0; y < H; ++y) {
????????????????????????????????seg[y] = new SegTree();
seg[y]->init(W);
????????????????????????}
????????????????}
????????????????else {
????????????????????????seg.resize(W);
????????????????????????for (int x = 0; x < W; ++x) {
????????????????????????????????seg[x] = new SegTree();
seg[x]->init(H);
????????????????????????}
????????????????}
??
????????????????for (int y = 0; y < H; ++y) {
????????????????????????for (int x = 0; x < W; ++x) {
????????????????????????????????if (isSegRow) seg[y]->update(x, m[y][x]);
????????????????????????????????else seg[x]->update(y, m[y][x]);
????????????????????????}
????????????????}
??
????????????????for (int t = 0; t < Q; ++t) {
????????????????????????int y1, x1, y2, x2; cin >> y1 >> x1 >> y2 >> x2;
??
????????????????????????int ans = INF;
????????????????????????if (isSegRow) {
????????????????????????????????for (int y = y1; y <= y2; ++y) {
????????????????????????????????????????ans = min(ans, seg[y]->get(x1, x2+1));
????????????????????????????????}
????????????????????????}
????????????????????????else {
????????????????????????????????for (int x = x1; x <= x2; ++x) {
????????????????????????????????????????ans = min(ans, seg[x]->get(y1, y2+1));
????????????????????????????????}
????????????????????????}
????????????????????????cout << ans << endl;
????????????????}
for(int i = 0 ; i < seg.size() ; i++) delete seg[i];
????????}
} | a.cc:2:1: error: expected unqualified-id before '?' token
2 | ??
| ^
a.cc:4:1: error: expected unqualified-id before '?' token
4 | ??
| ^
a.cc:67:1: error: expected unqualified-id before '?' token
67 | ??
| ^
a.cc:71:1: error: expected unqualified-id before '?' token
71 | ??
| ^
|
s464231791 | p00653 | C++ | #include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 10000000000
#define N 1000000000
int r,c,q;
int input;
vector<int> zu[1000];
int aaa,bbb,aa,bb;
int ans;
int n;
int ima;
int dat[1000][4*N];
void init(int n_)
{
n=1;
while(n<n_)n*=2;
rep(i,2*n-1)rep(j,1000)dat[j][i]=INF;
}
void update(int k,int a)
{
k+=n-1;
dat[ima][k]=a;
while(k>0)
{
k=(k-1)/2;
dat[ima][k]=min(dat[ima][k*2+1],dat[ima][k*2+2]);
}
}
int query(int a,int b,int k,int l,int r)
{
if(r<=a||b<=l)return INF;
if(a<=l&&r<=b)return dat[ima][k];
else
{
int v1=query(a,b,k*2+1,l,(l+r)/2);
int v2=query(a,b,k*2+2,(l+r)/2,r);
return min(v1,v2);
}
}
int main()
{
while(1)
{
rep(i,1000)zu[i].clear();
cin>>r>>c>>q;
if(r==0)break;
if(r<=c)
{
rep(i,r)
{
rep(j,c)
{
cin>>input;
zu[i].push_back(input);
}
}
}
else
{
rep(i,r)
{
rep(j,c)
{
cin>>input;
zu[j].push_back(input);
}
}
swap(r,c);
}
/*rep(i,r)
{
rep(j,c)cout<<zu[i][j]<<" ";
cout<<endl;
}*/
init(c);
//cout<<"n:"<<n<<endl;
rep(i,r)
{
ima=i;
rep(j,c)
{
update(j,zu[i][j]);
}
}
rep(kkk,q)
{
cin>>aaa>>bbb>>aa>>bb;
ans=INF;
rep2(i,aaa,aa+1)
{
ima=i;
cout<<query(bbb,bb+1,0,0,n)<<endl;
ans=min(ans,query(bbb,bb+1,0,0,n));
}
cout<<ans<<endl;
}
}
return 0;
} | a.cc:20:16: warning: integer overflow in expression of type 'int' results in '-294967296' [-Woverflow]
20 | int dat[1000][4*N];
| ^
a.cc:20:16: error: size '-294967296' of array 'dat' is negative
a.cc: In function 'void init(int)':
a.cc:11:13: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
11 | #define INF 10000000000
| ^~~~~~~~~~~
a.cc:25:42: note: in expansion of macro 'INF'
25 | rep(i,2*n-1)rep(j,1000)dat[j][i]=INF;
| ^~~
a.cc: In function 'int query(int, int, int, int, int)':
a.cc:11:13: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
11 | #define INF 10000000000
| ^~~~~~~~~~~
a.cc:39:30: note: in expansion of macro 'INF'
39 | if(r<=a||b<=l)return INF;
| ^~~
a.cc: In function 'int main()':
a.cc:11:13: warning: overflow in conversion from 'long int' to 'int' changes value from '10000000000' to '1410065408' [-Woverflow]
11 | #define INF 10000000000
| ^~~~~~~~~~~
a.cc:97:29: note: in expansion of macro 'INF'
97 | ans=INF;
| ^~~
|
s434618372 | p00653 | C++ | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = (1LL << 31) - 1;
struct segtree {
int H, W;
vector<vector<int>> dat;
segtree(vector<vector<int>> &f) {
H = W = 1;
while(H < (int)f.size()) H <<= 1;
while(W < (int)f[0].size()) W <<= 1;
dat.assign(2 * H - 1, vector<int>(2 * W - 1, INF));
init(f);
}
void init(vector<vector<int>> &f) {
for(int i = 0; i < (int)f.size(); i++)
for(int j = 0; j < (int)f[0].size(); j++)
dat[i + H - 1][j + W - 1] = f[i][j];
for(int i = 2 * H - 2; i > H - 2; i--)
for(int j = W - 2; j >= 0; j--)
dat[i][j] = min(dat[i][2 * j + 1], dat[i][2 * j + 2]);
for(int i = H - 2; i >= 0; i--)
for(int j = 0; j < 2 * W - 1; j++)
dat[i][j] = min(dat[2 * i + 1][j], dat[2 * i + 2][j]);
}
int query(int li, int lj, int ri, int rj) { return query_h(li, lj, ri, rj, 0, H, 0); }
int query_h(int li, int lj, int ri, int rj, int si, int ti, int k) {
if(ri <= si || ti <= li) return INF;
if(li <= si && ti <= ri) return query_w(lj, rj, 0, W, k, 0);
const int mi = (si + ti) / 2;
return min(query_h(li, lj, ri, rj, si, mi, 2 * k + 1), query_h(li, lj, ri, rj, mi, ti, 2 * k + 2));
}
int query_w(int lj, int rj, int sj, int tj, int i, int k) {
if(rj <= sj || tj <= lj) return INF;
if(lj <= sj && tj <= rj) return dat[i][k];
const int mj = (sj + tj) / 2;
return min(query_w(lj, rj, sj, mj, i, 2 * k + 1), query_w(lj, rj, mj, tj, i, 2 * k + 2));
}
};
segtree st;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int r, c, q;
while(cin >> r >> c >> q, r | c | q) {
vector<vector<int>> f(r, vector<int>(c));
for(int i = 0; i < r; i++) {
for(int j = 0; j < c; j++) {
cin >> f[i][j];
}
}
st.init(f);
while(q--) {
int r1, c1, r2, c2;
cin >> r1 >> c1 >> r2 >> c2;
cout << st.query(r1, c1, r2 + 1, c2 + 1) << endl;
}
}
} | a.cc:43:9: error: no matching function for call to 'segtree::segtree()'
43 | segtree st;
| ^~
a.cc:10:9: note: candidate: 'segtree::segtree(std::vector<std::vector<int> >&)'
10 | segtree(vector<vector<int>> &f) {
| ^~~~~~~
a.cc:10:9: note: candidate expects 1 argument, 0 provided
a.cc:7:8: note: candidate: 'segtree::segtree(const segtree&)'
7 | struct segtree {
| ^~~~~~~
a.cc:7:8: note: candidate expects 1 argument, 0 provided
a.cc:7:8: note: candidate: 'segtree::segtree(segtree&&)'
a.cc:7:8: note: candidate expects 1 argument, 0 provided
|
s549714318 | p00653 | C++ | //import java.util.Scanner;
import java.io.*;
class Rmq{
int segt[] = new int[(1<<21)*2];
public int inp[] =new int[(1<<21)];
int MAX_VALUE=2147483647;
int min(int a,int b){return a<b?a:b;}
int max(int a,int b){return a>b?a:b;}
void update(int value,int pos,int n){
int index=n-1+pos;
segt[index]=value;//[pos,pos]
while(index>0){
index=(index-1)/2;
segt[index]=min(segt[index*2+1],segt[index*2+2]);
}
}
int query(int l,int r,int now,int ql,int qr){
if (l == ql && r == qr){
return segt[now];
}
int midr=(l+r)/2,midl=midr+1;
int ret=MAX_VALUE;
if (ql <= midr)ret=min(ret,query(l,midr,now*2+1,ql,min(qr,midr)));
if (midl <= qr)ret=min(ret,query(midl,r,now*2+2,max(midl,ql),qr));
return ret;
}
public void init(int r,int c,int lim){
boolean isrowmajor=r<=c;
for(int i=0;i<lim;i++){
segt[i]=MAX_VALUE;
}
if (isrowmajor){
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
update(inp[i*c+j],i*c+j,lim);
}
}
}else {
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
update(inp[i+j*r],i+j*r,lim);
}
}
}
}
int searchmin(int r1,int c1,int r2,int c2,int r,int c,int lim){
boolean isrowmajor = r<=c;
int ret=MAX_VALUE;
lim--;
if (isrowmajor){
for(int i=r1;i<=r2;i++){
ret=min(ret,query(0,lim,0,i*c+c1,i*c+c2));
}
}else {
for(int j=c1;j<=c2;j++){
ret=min(ret,query(0,lim,0,j*r+r1,j*r+r2));
}
}
return ret;
}
}
class Main{
void run(){
Scanner in = new Scanner();
//System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
int r,c,q;
Rmq rmq=new Rmq();
while(true){
r=in.nextInt();
c=in.nextInt();
q=in.nextInt();
if (r == 0)break;
int lim=1;
boolean isrowmajor = r<=c;
while(true){
if (lim >= r*c)break;
lim*=2;
}
if (isrowmajor){
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
rmq.inp[i*c+j]=in.nextInt();
}
}
}else {
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
rmq.inp[i+j*r]=in.nextInt();
}
}
}
rmq.init(r,c,lim);
for(int i=0;i<q;i++){
int r1,r2,c1,c2;
r1=in.nextInt();
c1=in.nextInt();
r2=in.nextInt();
c2=in.nextInt();
System.out.println(rmq.searchmin(r1,c1,r2,c2,r,c,lim));
}
}
}
public static void main(String args[]){
Main a = new Main();
a.run();
}
}
class Scanner {
int nextInt() {
try {
int c = System.in.read();
if (c == -1)
return c;
while (c != '-' && (c < '0' || '9' < c)) {
c = System.in.read();
if (c == -1)
return c;
}
if (c == '-')
return -nextInt();
int res = 0;
do {
res *= 10;
res += c - '0';
c = System.in.read();
} while ('0' <= c && c <= '9');
return res;
} catch (Exception e) {
return -1;
}
}
long nextLong() {
try {
int c = System.in.read();
if(c==-1)return -1;
while (c != '-' && (c < '0' || '9' < c)){
c = System.in.read();
if(c==-1)return -1;
}
if (c == '-')
return -nextLong();
long res = 0;
do {
res *= 10;
res += c - '0';
c = System.in.read();
} while ('0' <= c && c <= '9');
return res;
} catch (Exception e) {
return -1;
}
}
double nextDouble() {
return Double.parseDouble(next());
}
String next() {
try {
StringBuilder res = new StringBuilder("");
int c = System.in.read();
while (Character.isWhitespace(c))
c = System.in.read();
do {
res.append((char) c);
} while (!Character.isWhitespace(c = System.in.read()));
return res.toString();
} catch (Exception e) {
return null;
}
}
String nextLine() {
try {
StringBuilder res = new StringBuilder("");
int c = System.in.read();
while (c == '\r' || c == '\n')
c = System.in.read();
do {
res.append((char) c);
c = System.in.read();
} while (c != '\r' && c != '\n');
return res.toString();
} catch (Exception e) {
return null;
}
}
} | a.cc:2:1: error: 'import' does not name a type
2 | import java.io.*;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:11: error: expected ':' before 'int'
6 | public int inp[] =new int[(1<<21)];
| ^~~~
| :
a.cc:29:11: error: expected ':' before 'void'
29 | public void init(int r,int c,int lim){
| ^~~~~
| :
a.cc:5:9: error: flexible array member 'Rmq::segt' not at end of 'class Rmq'
5 | int segt[] = new int[(1<<21)*2];
| ^~~~
a.cc:64:2: error: expected ';' after class definition
64 | }
| ^
| ;
a.cc:5:9: error: initializer for flexible array member 'int Rmq::segt []'
5 | int segt[] = new int[(1<<21)*2];
| ^~~~
a.cc:6:16: error: initializer for flexible array member 'int Rmq::inp []'
6 | public int inp[] =new int[(1<<21)];
| ^~~
a.cc: In member function 'void Rmq::init(int, int, int)':
a.cc:30:9: error: 'boolean' was not declared in this scope; did you mean 'bool'?
30 | boolean isrowmajor=r<=c;
| ^~~~~~~
| bool
a.cc:34:13: error: 'isrowmajor' was not declared in this scope
34 | if (isrowmajor){
| ^~~~~~~~~~
a.cc: In member function 'int Rmq::searchmin(int, int, int, int, int, int, int)':
a.cc:49:9: error: 'boolean' was not declared in this scope; did you mean 'bool'?
49 | boolean isrowmajor = r<=c;
| ^~~~~~~
| bool
a.cc:52:13: error: 'isrowmajor' was not declared in this scope
52 | if (isrowmajor){
| ^~~~~~~~~~
a.cc: At global scope:
a.cc:107:11: error: expected ':' before 'static'
107 | public static void main(String args[]){
| ^~~~~~~
| :
a.cc:107:29: error: 'String' has not been declared
107 | public static void main(String args[]){
| ^~~~~~
a.cc:111:2: error: expected ';' after class definition
111 | }
| ^
| ;
a.cc: In member function 'void Main::run()':
a.cc:68:9: error: 'Scanner' was not declared in this scope
68 | Scanner in = new Scanner();
| ^~~~~~~
a.cc:73:15: error: 'in' was not declared in this scope; did you mean 'int'?
73 | r=in.nextInt();
| ^~
| int
a.cc:78:13: error: 'boolean' was not declared in this scope; did you mean 'bool'?
78 | boolean isrowmajor = r<=c;
| ^~~~~~~
| bool
a.cc:83:17: error: 'isrowmajor' was not declared in this scope
83 | if (isrowmajor){
| ^~~~~~~~~~
a.cc:103:17: error: 'System' was not declared in this scope
103 | System.out.println(rmq.searchmin(r1,c1,r2,c2,r,c,lim));
| ^~~~~~
a.cc: In static member function 'static void Main::main(int*)':
a.cc:108:18: error: conversion from 'Main*' to non-scalar type 'Main' requested
108 | Main a = new Main();
| ^~~~~~~~~~
a.cc: At global scope:
a.cc:165:5: error: 'String' does not name a type
165 | String next() {
| ^~~~~~
a.cc:180:5: error: 'String' does not name a type
180 | String nextLine() {
| ^~~~~~
a.cc:195:2: error: expected ';' after class definition
195 | }
| ^
| ;
a.cc: In member function 'int Scanner::nextInt()':
a.cc:117:21: error: 'System' was not declared in this scope
117 | int c = System.in.read();
| ^~~~~~
a.cc:134:18: error: 'Exception' does not name a type
134 | } catch (Exception e) {
| ^~~~~~~~~
a.cc: In member function 'long int Scanner::nextLong()':
a.cc:141:21: error: 'System' was not declared in this scope
141 | int c = System.in.read();
| ^~~~~~
a.cc:156:18: error: 'Exception' does not name a type
156 | } catch (Exception e) {
| ^~~~~~~~~
a.cc: In member function 'double Scanner::nextDouble()':
a.cc:162:16: error: 'Double' was not declared in this scope; did you mean 'double'?
162 | return Double.parseDouble(next());
| ^~~~~~
| double
a.cc:162:35: error: 'next' was not declared in this scope; did you mean 'nextInt'?
162 | return Double.parseDouble(next());
| ^~~~
| nextInt
|
s845798603 | p00653 | C++ | #include <cstdio>
#include <iostream>
#include <vector>
#define N 2555555
using namespace std;
struct node {
int lx, ly, rx, ry, mx, my, f;
} tree[N * 100];
vector<int> a[N];
void build(int d, int lx, int ly, int rx, int ry) {
tree[d].lx = lx;
tree[d].rx = rx;
tree[d].ly = ly;
tree[d].ry = ry;
if (lx == rx && ly == ry) {
tree[d].f = a[lx][ly];
return;
}
tree[d].mx = (lx + rx) >> 1;
tree[d].my = (ly + ry) >> 1;
if (lx == rx) {
build(d << 2, lx, ly, lx, tree[d].my);
build(d << 2 | 1, lx, tree[d].my + 1, rx, ry);
tree[d].f = min(tree[d << 2].f, tree[d << 2 | 1].f);
} else if (ly == ry) {
build(d << 2 | 2, lx, ly, tree[d].mx, ry);
build(d << 2 | 3, tree[d].mx + 1, ry, rx, ry);
tree[d].f = min(tree[d << 2 | 2].f, tree[d << 2 | 3].f);
} else {
build(d << 2, lx, ly, tree[d].mx, tree[d].my);
build(d << 2 | 1, lx, tree[d].my + 1, tree[d].mx, ry);
build(d << 2 | 2, tree[d].mx + 1, ly, rx, tree[d].my);
build(d << 2 | 3, tree[d].mx + 1, tree[d].my + 1, rx, ry);
int ll = min(tree[d << 2].f, tree[d << 2 | 1].f);
int rr = min(tree[d << 2 | 2].f, tree[d << 2 | 3].f);
tree[d].f = min(ll, rr);
}
}
int find(int d, int lx, int ly, int rx, int ry) {
if (lx == tree[d].lx && ly == tree[d].ly && rx == tree[d].rx && ry == tree[d].ry) return tree[d].f;
if (rx <= tree[d].mx && ry <= tree[d].my) return find(d << 2, lx, ly, rx, ry);
if (rx <= tree[d].mx && ly > tree[d].my) return find(d << 2 | 1, lx, ly, rx, ry);
if (lx > tree[d].mx && ry <= tree[d].my) return find(d << 2 | 2, lx, ly, rx, ry);
if (lx > tree[d].mx && ly > tree[d].my) return find(d << 2 | 3, lx, ly, rx, ry);
if (rx <= tree[d].mx) return min(find(d << 2, lx, ly, rx, tree[d].my), find(d << 2 | 1, lx, tree[d].my + 1, rx, ry));
if (lx > tree[d].mx) return min(find(d << 2 | 2, lx, ly, rx, tree[d].my), find(d << 2 | 3, lx, tree[d].my + 1, rx, ry));
if (ry <= tree[d].my) return min(find(d << 2, lx, ly, tree[d].mx, ry), find(d << 2 | 2, tree[d].mx + 1, ly, rx, ry));
if (ry > tree[d].my) return min(find(d << 2 | 1, lx, ly, tree[d].mx, ry), find(d << 2 | 3, tree[d].mx + 1, ly, rx, ry));
int ll = min(find(d << 2, lx, ly, tree[d].mx, tree[d].my), find(d << 2 | 2, tree[d].mx + 1, ly, rx, tree[d].my));
int rr = min(find(d << 2 | 1, lx, tree[d].my + 1, tree[d].mx, ry), find(d << 2 | 3, tree[d].mx + 1, tree[d].my + 1, rx, ry));
return min(ll, rr);
}
int main() {
int n, m, T;
scanf("%d%d%d", &n, &m, &T);
while (m + n + T) {
for (int i = 1; i <= n; i++) {
a[i].clear();
a[i].push_back(0);
for (int j = 1; j <= m; j++) {
int x;
scanf("%d", &x);
a[i].push_back(x);
}
}
build(1, 1, 1, n, m);
for (int i = 1; i <= T; i++) {
int xl, xr, yl, yr;
scanf("%d%d%d%d", &xl, &yl, &xr, &yr);
printf("%d\n", find(1, xl + 1, yl + 1, xr + 1, yr + 1));
}
scanf("%d%d%d", &n, &m, &T);
}
return 0;
} | /tmp/ccPE1kzA.o: in function `build(int, int, int, int, int)':
a.cc:(.text+0xce): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccPE1kzA.o
/tmp/ccPE1kzA.o: in function `main':
a.cc:(.text+0xe24): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccPE1kzA.o
a.cc:(.text+0xe49): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccPE1kzA.o
a.cc:(.text+0xea0): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccPE1kzA.o
/tmp/ccPE1kzA.o: in function `__tcf_0':
a.cc:(.text+0xfbc): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccPE1kzA.o
a.cc:(.text+0xfca): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccPE1kzA.o
/tmp/ccPE1kzA.o: in function `__static_initialization_and_destruction_0()':
a.cc:(.text+0xff1): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccPE1kzA.o
collect2: error: ld returned 1 exit status
|
s916818051 | p00653 | C++ | #include<stdio.h>
#include<string.h>
#include<limits.h>
const int maxn = 1000000*2;
int n;
struct node
{
int x1,x2,y1,y2;
int min;
int ch[4];
};
node tree[maxn];
int tol;
void maketree(int x1,int x2,int y1,int y2)
{
int k = ++tol;
tree[k].x1 = x1;
tree[k].x2 = x2;
tree[k].y1 = y1;
tree[k].y2 = y2;
tree[k].min = 0;
if(x1 == x2 && y1==y2)
{
scanf("%d",&tree[k].min);
memset(tree[k].ch,0,sizeof(tree[k].ch));
return ;
}
int midx = (x1+x2)>>1;
int midy = (y1+y2)>>1;
tree[k].ch[0] = tol+1;
maketree(x1,midx,y1,midy);
if(midy+1 <= y2)
{
tree[k].ch[2] = tol+1;
maketree(x1,midx,midy+1,y2);
}
else
tree[k].ch[2] = 0;
if(midx+1 <= x2)
{
tree[k].ch[3] = tol+1;
maketree(midx+1,x2,y1,midy);
}
else
tree[k].ch[3] = 0;
if(midx+1 <= x2 && midy+1 <= y2)
{
tree[k].ch[1] = tol+1;
maketree(midx+1,x2,midy+1,y2);
}
else
tree[k].ch[1] = 0;
tree[k].min = tree[tree[k].ch[0]].min;
for(int i=1; i<4; i++)
if(tree[k].ch[i])
tree[k].min = min(tree[k].min,tree[tree[k].ch[i]].min);
}
inline bool cross(int x1,int x2,int y1,int y2,int k)
{
if(x2 < tree[k].x1 || tree[k].x2 < x1 || y2 < tree[k].y1 || tree[k].y2 < y1)
return false;
return true;
}
int Query(int x1,int x2,int y1,int y2,int k)
{
if(cross(x1,x2,y1,y2,k) == 0)
return INT_MAX;
if(x1 <= tree[k].x1 && tree[k].x2 <= x2 && y1<= tree[k].y1 && tree[k].y2 <= y2)
return tree[k].min;
int minx = Query(x1,x2,y1,y2,tree[k].ch[0]);
for(int i=1; i<4; i++)
minx = min(minx,Query(x1,x2,y1,y2,tree[k].ch[i]));
return minx;
}
int main()
{
int r,c,q,temp;
int x1,y1,x2,y2;
while(( scanf( "%d%d%d",&r,&c,&q ),r ))
{
tol=0;
maketree(1,r,1,c);
while(q--)
{
scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
x1++,y1++,x2++,y2++;
printf("%d\n",Query(x1,x2,y1,y2,1));
}
}
} | a.cc: In function 'void maketree(int, int, int, int)':
a.cc:66:27: error: 'min' was not declared in this scope
66 | tree[k].min = min(tree[k].min,tree[tree[k].ch[i]].min);
| ^~~
a.cc: In function 'int Query(int, int, int, int, int)':
a.cc:86:16: error: 'min' was not declared in this scope; did you mean 'minx'?
86 | minx = min(minx,Query(x1,x2,y1,y2,tree[k].ch[i]));
| ^~~
| minx
|
s892205925 | p00653 | C++ | #include<cstdio>
#include<vector>
#define la (rt*4)
#define lb (rt*4+1)
#define lc (rt*4+2)
#define ld (rt*4+3)
#define MIN(A,B) ((A)>(B)?(B):(A))
using namespace std;
int r, c, q;
struct seg
{
int x1,y1,x2,y2;
int v;
int midx()
{
return (x1+x2)>>1;
}
int midy()
{
return (y1+y2)>>1;
}
}tr[1000010*5];
int map[1000010];
void build(int rt,int x1,int y1,int x2,int y2)
{
tr[rt].x1 = x1;
tr[rt].y1 = y1;
tr[rt].x2 = x2;
tr[rt].y2 = y2;
if(x1==x2 && y1==y2)
{
tr[rt].v = map[x1*c + y1];
return;
}
int mx = tr[rt].midx();
int my = tr[rt].midy();
if(x1 == x2)
{
build(la,x1,y1,mx,my);
build(lb,x1,my+1,mx,y2);
tr[rt].v = MIN(tr[la].v,tr[lb].v);
}
else if(y1 == y2)
{
build(la,x1,y1,mx,my);
build(lc,mx+1,y1,x2,my);
tr[rt].v = MIN(tr[la].v,tr[lc].v);
}
else
{
build(la,x1,y1,mx,my);
build(lb,x1,my+1,mx,y2);
build(lc,mx+1,y1,x2,my);
build(ld,mx+1,my+1,x2,y2);
tr[rt].v = MIN(tr[la].v,tr[lb].v);
tr[rt].v = MIN(tr[rt].v,tr[lc].v);
tr[rt].v = MIN(tr[rt].v,tr[ld].v);
}
return;
}
int query(int rt,int x1,int y1,int x2,int y2)
{
if(x1==tr[rt].x1&&x2==tr[rt].x2&&y2==tr[rt].y2&&y1==tr[rt].y1)
{
return tr[rt].v;
}
int mx = tr[rt].midx();
int my = tr[rt].midy();
//1
if(x2<=mx&&y2<=my)
return query(la,x1,y1,x2,y2);
if(y1>my&&x2<=mx)
return query(lb,x1,y1,x2,y2);
if(x1>mx&&y2<=my)
return query(lc,x1,y1,x2,y2);
if(mx<x1&&my<y1)
return query(ld,x1,y1,x2,y2);
//2
if(x2<=mx)
{
int a = query(la,x1,y1,x2,my);
int b = query(lb,x1,my+1,x2,y2);
return MIN(a,b);
}
if(y2<=my)
{
int a = query(la,x1,y1,mx,y2);
int b = query(lc,mx+1,y1,x2,y2);
return MIN(a,b);
}
if(x1>mx)
{
int a = query(lc,x1,y1,x2,my);
int b = query(ld,x1,my+1,x2,y2);
return MIN(a,b);
}
if(y1>my)
{
int a = query(lb,x1,y1,mx,y2);
int b = query(ld,mx+1,y1,x2,y2);
return MIN(a,b);
}
//3
int a = query(la,x1,y1,mx,my);
int b = query(lb,x1,my+1,mx,y2);
int c = query(lc,mx+1,y1,x2,my);
int d = query(ld,mx+1,my+1,x2,y2);
int e = MIN(a,b);
e = MIN(e,c);
e = MIN(e,d);
return e;
}
int main()
{
while(scanf("%d%d%d",&r,&c,&q),r||c||q)
{
for(int i = 0; i < r; ++i)
for(int j = 0; j < c; ++j)
scanf("%d",&map[i*c + j]);
/* build(1,0,0,r-1,c-1);
for(int i = 0; i < q; ++i)
{
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
printf("%d\n",query(1,a,b,c,d));
}
} */
return 0;
} | a.cc: In function 'int main()':
a.cc:132:2: error: expected '}' at end of input
132 | }
| ^
a.cc:116:1: note: to match this '{'
116 | {
| ^
|
s524913510 | p00653 | C++ | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int n;
int r,c,q;
int r1,c1,r2,c2;
int tmp;
vector<int> seg[1000];
void init(int num,int n_){
seq[num].clear();
for(int i=0;i<2*n_-1;i++)seg[num].push_back( (1<<31)-1 );
}
void update(int x,int k, int a){
k += n-1;
seg[x][k] = a;
while(k>0){
k = (k-1) / 2;
seg[x][k] = min(seg[x][k*2+1], seg[x][k*2+2]);
}
}
int query(int x, int a, int b, int k, int l, int r){
if(r<=a || b<=l)return (1<<31) - 1;
if(a<=l && r<=b)return seg[x][k];
else{
return min(query(x,a,b,2*k+1,l,(l+r)/2),query(x,a,b,2*k+2,(l+r)/2,r));
}
}
int main(){
while(1){
cin >> r >> c >> q;
if(!r && !c && !q)break;
if(r>=c){
n = 1;
while(n<r)n *= 2;
for(int i=0;i<c;i++)init(i,n);
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
cin >> tmp;
update(j,i,tmp);
}
}
while(q--){
cin >> r1 >> c1 >> r2 >> c2;
int ans = (1<<31) - 1;
for(int i=c1;i<=c2;i++)ans = min(ans,query(i,r1,r2+1,0,0,n));
cout << ans << endl;
}
}else{
n = 1;
while(n<c)n *= 2;
for(int i=0;i<r;i++)init(i,n);
for(int i=0;i<r;i++){
for(int j=0;j<c;j++){
cin >> tmp;
update(i,j,tmp);
}
}
while(q--){
cin >> r1 >> c1 >> r2 >> c2;
int ans = (1<<31) - 1;
for(int i=r1;i<=r2;i++)ans = min(ans,query(i,c1,c2+1,0,0,n));
cout << ans << endl;
}
}
}
} | a.cc: In function 'void init(int, int)':
a.cc:13:3: error: 'seq' was not declared in this scope; did you mean '__pstl::execution::v1::seq'?
13 | seq[num].clear();
| ^~~
| __pstl::execution::v1::seq
In file included from /usr/include/c++/14/pstl/glue_algorithm_defs.h:15,
from /usr/include/c++/14/algorithm:86,
from a.cc:2:
/usr/include/c++/14/pstl/execution_defs.h:42:46: note: '__pstl::execution::v1::seq' declared here
42 | _GLIBCXX17_INLINE constexpr sequenced_policy seq{};
| ^~~
a.cc:14:55: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow]
14 | for(int i=0;i<2*n_-1;i++)seg[num].push_back( (1<<31)-1 );
| ~~~~~~~^~
a.cc: In function 'int query(int, int, int, int, int, int)':
a.cc:27:34: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow]
27 | if(r<=a || b<=l)return (1<<31) - 1;
| ~~~~~~~~^~~
a.cc: In function 'int main()':
a.cc:51:27: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow]
51 | int ans = (1<<31) - 1;
| ~~~~~~~~^~~
a.cc:67:27: warning: integer overflow in expression of type 'int' results in '2147483647' [-Woverflow]
67 | int ans = (1<<31) - 1;
| ~~~~~~~~^~~
|
s119281563 | p00653 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
#include <cstdio>
using namespace std;
const int MAX_N=4100000;
typedef long long ll;
// ZOgØðÂO[ozñ
// 0 <-> h*w-1ÌindexÉÀf[^ª¶Ý
ll dat[2*MAX_N-1];
int h,w;
const ll INF=0x7f7f7f7f7f7f7f7f;
// ú»
void init(int h_,int w_){
h=1;
w=1;
while(h<h_)
h*=2;
while(w<w_)
w*=2;
memset(dat,0x7f,sizeof(dat));
// fill(dat,dat+2*h*w-1,INF);
}
// kÔÚÌl(0-indexed)ðaÉÏX
void update(int k,int a){
// tÌß_
k+=(h*w-1);
dat[k]=a;
// ÌÚèȪçXV
while(k>0){
k=(k-1)/2;
//if(dat[k*2+2]==-1)
// dat[k]=dat[k*2+1];
//else if(dat[k*2+1]==-1)
// dat[k]=dat[k*2+2];
//else
// dat[k]=min(dat[k*2+1],dat[k*2+2]);
dat[k]=min(dat[k*2+1],dat[k*2+2]);
}
}
ll query(int qminx,int qminy,int qmaxx,int qmaxy,int k,int minx,int miny,int maxx,int maxy){
// dÈçÈ¢
if(qmaxx<minx||maxx<qminx||qmaxy<miny||maxy<qminy)
return INF;
// ¡ñÌÌæª®SÉÜÜêé
else if(minx>=qminx&&qmaxx>=maxx&&miny>=qminy&&qmaxy>=maxy)
return dat[k];
ll vl,vr;
// Å͡ɪ
if(miny!=maxy){
int midY=(miny+maxy)/2;
vl=query(qminx,qminy,qmaxx,qmaxy,k*2+1,minx,miny,maxx,midY);
vr=query(qminx,qminy,qmaxx,qmaxy,k*2+2,minx,midY+1,maxx,maxy);
}
// ªµ«Á½çc
else{
int midX=(minx+maxx)/2;
vl=query(qminx,qminy,qmaxx,qmaxy,k*2+1,minx,miny,midX,maxy);
vr=query(qminx,qminy,qmaxx,qmaxy,k*2+2,midX+1,miny,maxx,maxy);
}
//if(vr==-1)
// return vl;
//else if(vl==-1)
// return vr;
return min(vl,vr);
}
int main(){
int r,c,q;
while(scanf("%d %d %d\n",&r,&c,&q)&&!(r==0&&c==0&&q==0)){
init(r,c);
for(int i = 0; i < r; i++){
for(int j = 0; j < c; j++){
int t;
scanf("%d",&t);
update(i*w+j,t);
}
}
for(int i = 0; i < q; i++){
int a,b,c,d;
scanf("%d %d %d %d\n",&a,&b,&c,&d);
ll res=query(b,a,d,c,0,0,0,w-1,h-1);
printf("%d\n",res);
}
}
return 0;
} | a.cc: In function 'void init(int, int)':
a.cc:24:5: error: 'memset' was not declared in this scope
24 | memset(dat,0x7f,sizeof(dat));
| ^~~~~~
a.cc:6:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
5 | #include <cstdio>
+++ |+#include <cstring>
6 |
|
s111476973 | p00653 | C++ | #include <cstdio>
#include <cstring>
#include <climits>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int H, W;
int Q;
while (1){
scanf("%d %d %d", &H, &W, &Q);
if (H + W + Q == 0){
break;
}
int Hs = (int)sqrt(H) + 1;
int Ws = (int)sqrt(W) + 1;
vector<vector<int> > grid(H, vector<int>(W));
vector<vector<int> > cmp(Hs, vector<int>(Ws));
for (int i = 0; i < Hs; i++){
for (int j = 0; j < Ws; j++){
cmp[i][j] = INT_MAX;
}
}
for (int i = 0; i < H; i++){
for (int j = 0; j < W; j++){
scanf("%d", &grid[i][j]);
cmp[i / Hs][j / Ws] = min(cmp[i / Hs][j / Ws], grid[i][j]);
}
}
for (int i = 0; i < Hs; i++){
for (int j = 0; j < Ws; j++){
printf("%d%c", cmp[i][j], j == Ws - 1 ? '\n' : ' ');
}
}
for (int i = 0; i < Q; i++){
int h1, w1, h2, w2;
scanf("%d %d %d %d", &h1, &w1, &h2, &w2);
int res = INT_MAX;
for (int j = 0; j < Hs; j++){
for (int k = 0; k < Ws; k++){
if (h1 <= j * Hs && (j + 1) * Hs < h2
&& w1 <= k * Ws && (k + 1) * Ws < w2){
res = min(res, cmp[j][k]);
}
else {
for (int l = max(j * Hs, h1); l <= min((j + 1) * Hs, h2); l++){
for (int m = max(k * Ws, w1); k <= min((k + 1) * Ws, w2); k++){
res = min(res, grid[l][m]);
}
}
}
}
}
printf("%d\n", res);
}
}
return (0);
} | a.cc: In function 'int main()':
a.cc:21:31: error: 'sqrt' was not declared in this scope
21 | int Hs = (int)sqrt(H) + 1;
| ^~~~
|
s693381433 | p00653 | C++ | #include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
using namespace std;
#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }
typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
struct RMQ{
vector<int> data;
int N;
RMQ(int n){
N = 1;
while(N < n) N *= 2;
data = vector<int>(2 * N, INT_MAX);
}
void update(int k, int x){
k += N - 1;
data[k] = x;
while(k > 0){
k = (k - 1) / 2;
data[k] = min(data[2 * k + 1], data[2 * k + 2]);
}
}
int query(int a, int b){
return query(a, b, 0, 0, N);
}
int query(int a, int b, int k, int l, int r){
if(b <= l || r <= a) return INT_MAX;
if(a <= l && r <= b){
return data[k];
}else{
return min(query(a, b, 2 * k + 1, l, (l + r) / 2), query(a, b, 2 * k + 2, (l + r) / 2, r));
}
}
};
int main(){
int H, W, Q;
while(cin>>H>>W>>Q && H){
if(H < W){
//HlogW * Q = 10^7log10^3
vector<RMQ> rmq(H, RMQ(W));
REP(y, H){
REP(x, W){
int t; scanf("%d", &t);
rmq[y].update(x, t);
}
}
REP(i, Q){
int y1, x1, y2, x2;
scanf("%d %d %d %d", &y1, &x1, &y2, &x2);
int res = INT_MAX;
for(int y = y1; y <= y2; y++){
res = min(res, rmq[y].query(x1, x2 + 1));
}
printf("%d\n", res);
}
}else{
//WlogH * Q
vector<RMQ> rmq(W, RMQ(H));
REP(y, H){
REP(x, W){
int t; scanf("%d", &t);
rmq[x].update(y, t);
}
}
REP(i, Q){
int y1, x1, y2, x2;
scanf("%d %d %d %d", &y1, &x1, &y2, &x2);
int res = INT_MAX;
for(int x = x1; x <= x2; x++){
res = min(res, rmq[x].query(y1, y2 + 1));
}
printf("%d\n", res);
}
}
}
return 0;
} | a.cc: In constructor 'RMQ::RMQ(int)':
a.cc:37:31: error: 'INT_MAX' was not declared in this scope
37 | data = vector<int>(2 * N, INT_MAX);
| ^~~~~~~
a.cc:15:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
14 | #include <cassert>
+++ |+#include <climits>
15 |
a.cc: In member function 'int RMQ::query(int, int, int, int, int)':
a.cc:51:33: error: 'INT_MAX' was not declared in this scope
51 | if(b <= l || r <= a) return INT_MAX;
| ^~~~~~~
a.cc:51:33: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc: In function 'int main()':
a.cc:75:19: error: 'INT_MAX' was not declared in this scope
75 | int res = INT_MAX;
| ^~~~~~~
a.cc:75:19: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:93:19: error: 'INT_MAX' was not declared in this scope
93 | int res = INT_MAX;
| ^~~~~~~
a.cc:93:19: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
|
s805681662 | p00653 | C++ | #include <algorithm>
#include <cstdlib>
#include <iostream>
#include <vector>
using namespace std;
typedef int type;
const type INIT = INT_MAX;
class segment_tree {
private:
int n;
vector<type> dat;
inline type function(type a, type b) const {
return min(a, b);
}
type query(int a, int b, int k, int l, int r) const {
if(r <= a || b <= l)
return INIT;
if(a <= l && r <= b) {
return dat[k];
}
else {
const type vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
const type vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
return function(vl, vr);
}
}
public:
segment_tree(int n_) {
n = 1;
while(n < n_) n *= 2;
dat.resize(2 * n - 1, INIT);
}
inline void update(int k, type a) {
k += n - 1;
dat[k] = a;
while(k > 0) {
k = (k - 1) / 2;
dat[k] = function(dat[k * 2 + 1], dat[k * 2 + 2]);
}
}
inline type query(int a, int b) const {
return query(a, b, 0, 0, n);
}
const vector<type>& data() const {
return dat;
}
void merge(const segment_tree& s) {
const vector<type>& tmp = s.data();
if(dat.size() != tmp.size()) return;
for(int i = 0; i < (int)dat.size(); ++i) {
dat[i] = function(dat[i], tmp[i]);
}
}
};
class segment_tree_2d {
private:
int n;
vector<segment_tree> dat;
inline type function(type a, type b) const {
return min(a, b);
}
type query(int r1, int r2, int c1, int c2, int k, int l, int r) const {
if(r <= r1 || r2 <= l)
return INIT;
if(r1 <= l && r <= r2) {
return dat[k].query(c1, c2);
}
else {
const type vl = query(r1, r2, c1, c2, k * 2 + 1, l, (l + r) / 2);
const type vr = query(r1, r2, c1, c2, k * 2 + 2, (l + r) / 2, r);
return function(vl, vr);
}
}
public:
segment_tree_2d(int r, int c) {
n = 1;
while(n < r) n *= 2;
dat.resize(2 * n - 1, segment_tree(c));
}
inline void update(int y, int x, type a) {
y += n - 1;
dat[y].update(x, a);
while(y > 0) {
const int child = y;
y = (y - 1) / 2;
dat[y].merge(dat[child]);
}
}
inline type query(int r1, int r2, int c1, int c2) const {
return query(r1, r2, c1, c2, 0, 0, n);
}
};
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
for(int r, c, q; cin >> r >> c >> q, r;) {
segment_tree_2d seg(r, c);
for(int i = 0; i < r; ++i) {
for(int j = 0; j < c; ++j) {
int in;
cin >> in;
seg.update(i, j, in);
}
}
for(int i = 0; i < q; ++i) {
int r1, r2, c1, c2;
cin >> r1 >> c1 >> r2 >> c2;
cout << seg.query(r1, r2 + 1, c1, c2 + 1) << endl;
}
}
return EXIT_SUCCESS;
} | a.cc:8:19: error: 'INT_MAX' was not declared in this scope
8 | const type INIT = INT_MAX;
| ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
4 | #include <vector>
+++ |+#include <climits>
5 | using namespace std;
|
s070851159 | p00653 | C++ | #include<iostream>
#include<algorithm>
#include<functional>
#include<climits>
using namespace std;
template<class S=int, class T=std::less<S>, S nil=INT_MAX>
class RMQ{
friend class RMQ2D;
S *dat;
static int calcsize(int n){
int res=1;
while(res<n)res<<=1;
return res;
}
public:
RMQ():dat(0){
}
~RMQ(){
delete[] dat;
}
void build(int n,const S a[]){
int m=n;
n=calcsize(n);
dat=new S[2*n-1];
for(int i=0;i<m;i++)dat[n-1+i]=a[i];
for(int i=m;i<n;i++)dat[n-1+i]=nil;
for(int i=n-2;i>=0;i--){
dat[i]=std::min(dat[i*2+1],dat[i*2+2],T());
}
}
void update(int k,int a,int k,int l,int r){//k番目をaに変更
k+=n-1;
dat[k]=a;
while(k>0){
k=(k-1)/2;
dat[k]=std::min(dat[k*2+1],dat[k*2+2],T());
}
}
S query(int a,int b,int k,int l,int r)const{//[a,b)の最小(大)値
if(r<=a||b<=l)return nil;
if(a<=l&&r<=b)return dat[k];
else{
S vl=query(a,b,k*2+1,l,(l+r)/2);
S vr=query(a,b,k*2+2,(l+r)/2,r);
return std::min(vl,vr,T());
}
}
};
class RMQ2D{
typedef unsigned int S;
typedef std::less<S> T;
static const S nil=~0u;
int h,w;
RMQ<S,T,nil> *rmq;
int query(int a,int b,int k,int l,int r,int xs,int xe)const{
if(r<=a||b<=l)return nil;
if(a<=l&&r<=b)return rmq[k].query(xs,xe, 0,0,w);
else{
S vl=query(a,b,k*2+1,l,(l+r)/2,xs,xe);
S vr=query(a,b,k*2+2,(l+r)/2,r,xs,xe);
return std::min(vl,vr);
}
}
public:
RMQ2D(int h,int w,const S a[]){
S *dat;
int n=h,m=w;
h=this->h=RMQ<S,T,nil>::calcsize(h);
w=this->w=RMQ<S,T,nil>::calcsize(w);
dat=new S[2*w-1];
for(int i=0;i<w;i++)dat[i]=nil;
rmq=new RMQ<S,T,nil>[2*h-1];
for(int i=0;i<n;i++)rmq[h-1+i].build(m,a+i*m);
for(int i=n;i<h;i++)rmq[h-1+i].build(m,dat);
for(int i=h-2;i>=0;i--){
rmq[i].build(m,dat);
for(int j=0;j<2*w-1;j++)
rmq[i].dat[j]=std::min(rmq[i*2+1].dat[j],rmq[i*2+2].dat[j],T());
}
delete[] dat;
}
~RMQ2D(){
delete[] rmq;
}
void update(int y,int x,int a){
//「あとで」
}
int query(int ys,int ye,int xs,int xe)const{//[ys,ye)+[xs,xe)の最小(大)値
return query(ys,ye,0,0,h,xs,xe);
}
};
unsigned int g[1000000];
int main(){
int r,c,q;
while(cin>>r>>c>>q,r|c|q){
for(int i=0;i<r*c;i++)cin>>g[i];
RMQ2D rmq(r,c,g);
for(int i=0;i<q;i++){
int y1,x1,y2,x2;
cin>>y1>>x1>>y2>>x2;
cout<<rmq.query(y1,y2+1,x1,x2+1)<<endl;
}
}
return 0;
} | a.cc:35:37: error: redefinition of 'int k'
35 | void update(int k,int a,int k,int l,int r){//k番目をaに変更
| ~~~~^
a.cc:35:25: note: 'int k' previously declared here
35 | void update(int k,int a,int k,int l,int r){//k番目をaに変更
| ~~~~^
a.cc: In member function 'void RMQ<S, T, nil>::update(...)':
a.cc:36:20: error: 'n' was not declared in this scope
36 | k+=n-1;
| ^
|
s432940777 | p00653 | C++ | #include<iostream>
#include<algorithm>
#include<functional>
#include<climits>
using namespace std;
template<class S=int, class T=std::less<S>, S nil=INT_MAX>
class RMQ{
friend class RMQ2D;
S *dat;
static int calcsize(int n){
int res=1;
while(res<n)res<<=1;
return res;
}
public:
RMQ():dat(0){
}
~RMQ(){
delete[] dat;
}
void build(int n,const S a[]){
int m=n;
n=calcsize(n);
dat=new S[2*n-1];
for(int i=0;i<m;i++)dat[n-1+i]=a[i];
for(int i=m;i<n;i++)dat[n-1+i]=nil;
for(int i=n-2;i>=0;i--){
dat[i]=std::min(dat[i*2+1],dat[i*2+2],T());
}
}
void update(int k,int a){//k番目をaに変更
k+=n-1;
dat[k]=a;
while(k>0){
k=(k-1)/2;
dat[k]=std::min(dat[k*2+1],dat[k*2+2],T());
}
}
S query(int a,int b,int k,int l,int r)const{//[a,b)の最小(大)値
if(r<=a||b<=l)return nil;
if(a<=l&&r<=b)return dat[k];
else{
S vl=query(a,b,k*2+1,l,(l+r)/2);
S vr=query(a,b,k*2+2,(l+r)/2,r);
return std::min(vl,vr,T());
}
}
};
class RMQ2D{
typedef unsigned int S;
typedef std::less<S> T;
static const S nil=~0u;
int h,w;
RMQ<S,T,nil> *rmq;
int query(int a,int b,int k,int l,int r,int xs,int xe)const{
if(r<=a||b<=l)return nil;
if(a<=l&&r<=b)return rmq[k].query(xs,xe, 0,0,w);
else{
S vl=query(a,b,k*2+1,l,(l+r)/2,xs,xe);
S vr=query(a,b,k*2+2,(l+r)/2,r,xs,xe);
return std::min(vl,vr);
}
}
public:
RMQ2D(int h,int w,const S a[]){
S *dat;
int n=h,m=w;
h=this->h=RMQ<S,T,nil>::calcsize(h);
w=this->w=RMQ<S,T,nil>::calcsize(w);
dat=new S[2*w-1];
for(int i=0;i<w;i++)dat[i]=nil;
rmq=new RMQ<S,T,nil>[2*h-1];
for(int i=0;i<n;i++)rmq[h-1+i].build(m,a+i*m);
for(int i=n;i<h;i++)rmq[h-1+i].build(m,dat);
for(int i=h-2;i>=0;i--){
rmq[i].build(m,dat);
for(int j=0;j<2*w-1;j++)
rmq[i].dat[j]=std::min(rmq[i*2+1].dat[j],rmq[i*2+2].dat[j],T());
}
delete[] dat;
}
~RMQ2D(){
delete[] rmq;
}
void update(int y,int x,int a){
//「あとで」
}
int query(int ys,int ye,int xs,int xe)const{//[ys,ye)+[xs,xe)の最小(大)値
return query(ys,ye,0,0,h,xs,xe);
}
};
unsigned int g[1000000];
int main(){
int r,c,q;
while(cin>>r>>c>>q,r|c|q){
for(int i=0;i<r*c;i++)cin>>g[i];
RMQ2D rmq(r,c,g);
for(int i=0;i<q;i++){
int y1,x1,y2,x2;
cin>>y1>>x1>>y2>>x2;
cout<<rmq.query(y1,y2+1,x1,x2+1)<<endl;
}
}
return 0;
} | a.cc: In member function 'void RMQ<S, T, nil>::update(int, int)':
a.cc:36:20: error: 'n' was not declared in this scope
36 | k+=n-1;
| ^
|
s994731125 | p00653 | C++ | #include <iostream>
#include <cstdio>
using namespace std;
const int MAXN = 1000005;
long long map[MAXN];
int main()
{
long long Mina;
int i, j, r, c1, q;
int a, b, c, d;
while( cin >> r >> c1 >> q ) {
if( r == 0 && c == 0 && q == 0 )
break;
for( i = 0 ; i < r ; ++i ) {
for( j = 0 ; j < c1 ; ++j ) {
scanf( "%lld" , &map[i*c1+j] );
}
}
while( q -- ) {
cin >> a >> b >> c >> d;
Mina = map[a*c1+b];
for( i = a ; i <= c ; ++ i ) {
for( j = b + 1 ; j <= d ; ++j ) {
if( map[i*c1+j] < min )
Mina = map[i*c1+j];
}
}
printf( "%lld\n" , Mina );
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:24:57: error: invalid operands of types 'long long int' and '<unresolved overloaded function type>' to binary 'operator<'
24 | if( map[i*c1+j] < min )
| ~~~~~~~~~~~~^~~~~
|
s236776817 | p00654 | C | // Aizu Vol-10 1069: Squid Multiplication
// 2017.8.18 bal4u@uu
#include <stdio.h>
#include <stdlib.h>
typedef unsigned long long ulong;
ulong odd[255], even[255];
int ol, el;
ulong gcd(ulong a, ulong b)
{
ulong r;
while (b != 0) r = a % b, a = b, b = r;
return a;
}
int cmp(ulong *a, ulong *b) {
if (*a < *b) return -1;
if (*a == *b) return 0;
return 1;
}
int main()
{
int n, k, i;
ulong g, g2, e1, e2, o1;
while (scanf("%d", &n) && n) {
k = n*(n + 1) / 2;
for (ol = el = 0, i = 0; i < k; i++) {
scanf("%llu", &g);
if (g & 1) odd[ol++] = g;
else even[el++] = g;
}
qsort(odd, ol, sizeof(ulong), cmp);
qsort(even, el, sizeof(ulong), cmp);
e1 = even[0], e2 = even[1], o1 = odd[0];
g = gcd(e1, e2);
g2 = gcd(g, o1); g /= g2, o1 /= g2;
g2 = gcd(g, o1); g /= g2, o1 /= g2;
printf("%llu\n%llu", g, even[0]/g);
for (i = 1; i < n; i++) printf(" %llu", even[i]/g);
putchar('\n');
}
return 0;
} | main.c:7:28: error: conflicting types for 'ulong'; have 'long long unsigned int'
7 | typedef unsigned long long ulong;
| ^~~~~
In file included from /usr/include/stdlib.h:514,
from main.c:5:
/usr/include/x86_64-linux-gnu/sys/types.h:148:27: note: previous declaration of 'ulong' with type 'ulong' {aka 'long unsigned int'}
148 | typedef unsigned long int ulong;
| ^~~~~
main.c: In function 'main':
main.c:36:47: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types]
36 | qsort(odd, ol, sizeof(ulong), cmp);
| ^~~
| |
| int (*)(ulong *, ulong *) {aka int (*)(long long unsigned int *, long long unsigned int *)}
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(ulong *, ulong *)' {aka 'int (*)(long long unsigned int *, long long unsigned int *)'}
971 | __compar_fn_t __compar) __nonnull ((1, 4));
| ~~~~~~~~~~~~~~^~~~~~~~
main.c:37:48: error: passing argument 4 of 'qsort' from incompatible pointer type [-Wincompatible-pointer-types]
37 | qsort(even, el, sizeof(ulong), cmp);
| ^~~
| |
| int (*)(ulong *, ulong *) {aka int (*)(long long unsigned int *, long long unsigned int *)}
/usr/include/stdlib.h:971:34: note: expected '__compar_fn_t' {aka 'int (*)(const void *, const void *)'} but argument is of type 'int (*)(ulong *, ulong *)' {aka 'int (*)(long long unsigned int *, long long unsigned int *)'}
971 | __compar_fn_t __compar) __nonnull ((1, 4));
| ~~~~~~~~~~~~~~^~~~~~~~
|
s325194217 | p00654 | C | #include<stdio.h>
#include<math.h>
int main()
{
__int64 b[32000];
__int64 a[300];
int N;
int i;
__int64 sum;
while(scanf("%d",&N),N)
{
for(i=0;i<N*(N+1)/2;i++)
scanf("%lld",&b[i]);
sum=b[0]*b[1]/b[N];
a[0]=(__int64)sqrt(sum);
for(i=1;i<=N;i++)
a[i]=b[i-1]/a[0];
printf("%lld\n",a[0]);
for(i=1;i<N;i++)
printf("%lld ",a[i]);
printf("%lld\n",a[N]);
}
return 0;
}
| main.c: In function 'main':
main.c:6:4: error: unknown type name '__int64'; did you mean '__int64_t'?
6 | __int64 b[32000];
| ^~~~~~~
| __int64_t
main.c:7:4: error: unknown type name '__int64'; did you mean '__int64_t'?
7 | __int64 a[300];
| ^~~~~~~
| __int64_t
main.c:10:4: error: unknown type name '__int64'; did you mean '__int64_t'?
10 | __int64 sum;
| ^~~~~~~
| __int64_t
main.c:16:12: error: '__int64' undeclared (first use in this function); did you mean '__int64_t'?
16 | a[0]=(__int64)sqrt(sum);
| ^~~~~~~
| __int64_t
main.c:16:12: note: each undeclared identifier is reported only once for each function it appears in
main.c:16:20: error: expected ';' before 'sqrt'
16 | a[0]=(__int64)sqrt(sum);
| ^~~~
| ;
|
s196145852 | p00654 | C | #include<stdio.h>
#include<math.h>
long long int gcd(long long int x,long long int y)
{
while(x!=y)
{
if(x>y)
x=x-y;
else
y=y-x;
}
return x;
}
int main()
{
long long b[32000];
long long a[300];
int N;
int i;
__int64 sum;
while(scanf("%d",&N),N)
{
for(i=0;i<N*(N+1)/2;i++)
scanf("%lld",&b[i]);
a[1]=gcd(b[0],b[N]);
a[0]=b[0]/a[1];
for(i=2;i<=N;i++)
a[i]=b[i-1]/a[0];
printf("%lld\n",a[0]);
for(i=1;i<N;i++)
printf("%lld ",a[i]);
printf("%lld\n",a[N]);
}
return 0;
}
| main.c: In function 'main':
main.c:22:4: error: unknown type name '__int64'; did you mean '__int64_t'?
22 | __int64 sum;
| ^~~~~~~
| __int64_t
|
s306848189 | p00654 | C++ | //6.12
import java.util.Scanner;
import java.io.*;
import java.math.*;
import java.util.Arrays;
class Main{
long even[]=new long[1000];
long gcd(long a,long b){
return b==0?a:gcd(b,a%b);
}
void solve(int n,long oddmin){
Arrays.sort(even,0,n);
long ta=even[0];
for(int i=0;i<n;i++){
ta=gcd(ta,even[i]);
}
long tx0=even[0]/ta,tx1=even[1]/ta;
long g2=oddmin/tx0/tx1;
long g=(long)(Math.sqrt(g2));
//find A=A'/g
long evenans=ta/g;
//find all odd ans
System.out.println(evenans);
for(int i=0;i<n;i++){
if (i!=0)System.out.print(" ");
System.out.print(even[i]/evenans);
}
System.out.print("\n");
}
void run(){
Scanner in = new Scanner(System.in);
//System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
int n;
while(true){
n=in.nextInt();
if(n == 0)break;
int m=n*(n+1)/2;
int evenp=0;
long oddmin=9223372036854775807L;
for(int i=0;i<m;i++){
long tmp;
tmp=in.nextLong();
if (tmp%2 == 0)even[evenp++]=tmp;
else oddmin=(oddmin>tmp)?tmp:oddmin;
}
solve(n,oddmin);
}
}
public static void main(String args[]){
Main a = new Main();
a.run();
}
} | a.cc:2:1: error: 'import' does not name a type
2 | import java.util.Scanner;
| ^~~~~~
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.*;
| ^~~~~~
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.math.*;
| ^~~~~~
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:52:11: error: expected ':' before 'static'
52 | public static void main(String args[]){
| ^~~~~~~
| :
a.cc:52:29: error: 'String' has not been declared
52 | public static void main(String args[]){
| ^~~~~~
a.cc:8:10: error: flexible array member 'Main::even' in an otherwise empty 'class Main'
8 | long even[]=new long[1000];
| ^~~~
a.cc:56:2: error: expected ';' after class definition
56 | }
| ^
| ;
a.cc:8:10: error: initializer for flexible array member 'long int Main::even []'
8 | long even[]=new long[1000];
| ^~~~
a.cc: In member function 'void Main::solve(int, long int)':
a.cc:13:9: error: 'Arrays' was not declared in this scope
13 | Arrays.sort(even,0,n);
| ^~~~~~
a.cc:20:23: error: 'Math' was not declared in this scope
20 | long g=(long)(Math.sqrt(g2));
| ^~~~
a.cc:25:9: error: 'System' was not declared in this scope
25 | System.out.println(evenans);
| ^~~~~~
a.cc: In member function 'void Main::run()':
a.cc:33:9: error: 'Scanner' was not declared in this scope
33 | Scanner in = new Scanner(System.in);
| ^~~~~~~
a.cc:37:15: error: 'in' was not declared in this scope; did you mean 'int'?
37 | n=in.nextInt();
| ^~
| int
|
s603397059 | p00654 | C++ | #include<iostream>
#include<algorithm>
#include<string.h>
#include<cstdio>
#include<stack>
using namespace std;
#define LL long long
LL of[309],jf[90009], p[309];
int main(){
int n;
while(scanf("%d",&n),n){
int ol=0,jl=0;
for(int i=0; i<(n+1)*n/2;i++){
LL x;
scanf("%lld",&x);
if(x%2==0)
of[ol++] = x;
else
jf[jl++] = x;
}
sort(of,of+ol);
sort(jf,jf+jl);
LL a0 = int(sqrt((1.0*of[0]/jf[0]*of[1]))+0.001);
printf("%lld\n%lld",a0,of[0]/a0);
for(int i=1;i<n;i++)
printf(" %lld",of[i]/a0);
printf("\n");
}
return 0;
} | a.cc: In function 'int main()':
a.cc:26:29: error: 'sqrt' was not declared in this scope
26 | LL a0 = int(sqrt((1.0*of[0]/jf[0]*of[1]))+0.001);
| ^~~~
|
s653129473 | p00654 | C++ | #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdlib>
using namespace std;
typedef unsigned __int64 LL;
const int MAXN=300;
LL b,a[MAXN];
int n,m;
LL gcd(LL a,LL b){
if (!b) return a;
else return gcd(b,a%b);
}
int main()
{
while (cin>>n,n){
m=0;
for (int i=0;i<n*(n+1)/2;i++){
cin>>b;
if (b%2==0) a[m++]=b;
}
LL t=a[0];
for (int i=1;i<m;i++){
t=gcd(t,a[i]);
}
for (int i=0;i<m;i++){
a[i]/=t;
}
cout<<t<<'\n';
sort(a,a+m);
for (int i=0;i<m-1;i++)cout<<a[i]<<" ";
cout<<a[m-1]<<'\n';
}
return 0;
} | a.cc:8:26: error: expected initializer before 'LL'
8 | typedef unsigned __int64 LL;
| ^~
a.cc:10:1: error: 'LL' does not name a type
10 | LL b,a[MAXN];
| ^~
a.cc:12:1: error: 'LL' does not name a type
12 | LL gcd(LL a,LL b){
| ^~
a.cc: In function 'int main()':
a.cc:22:30: error: 'b' was not declared in this scope
22 | cin>>b;
| ^
a.cc:23:37: error: 'a' was not declared in this scope
23 | if (b%2==0) a[m++]=b;
| ^
a.cc:25:17: error: 'LL' was not declared in this scope
25 | LL t=a[0];
| ^~
a.cc:27:25: error: 't' was not declared in this scope
27 | t=gcd(t,a[i]);
| ^
a.cc:27:33: error: 'a' was not declared in this scope
27 | t=gcd(t,a[i]);
| ^
a.cc:27:27: error: 'gcd' was not declared in this scope
27 | t=gcd(t,a[i]);
| ^~~
a.cc:30:25: error: 'a' was not declared in this scope
30 | a[i]/=t;
| ^
a.cc:30:31: error: 't' was not declared in this scope
30 | a[i]/=t;
| ^
a.cc:32:23: error: 't' was not declared in this scope; did you mean 'tm'?
32 | cout<<t<<'\n';
| ^
| tm
a.cc:33:22: error: 'a' was not declared in this scope
33 | sort(a,a+m);
| ^
|
s370470124 | p00654 | C++ | /*
AizuOnline A1069
Squid Multiplication
*/
#include <stdio.h>
#include <math.h>
#include <float.h>
#define DEBUG 1
#define NUMOFODD 250
long long b[NUMOFODD*(NUMOFODD+1)];
int long long evens[300];
int N = 4;
int prime[10]={2,3,5,7,11,13,17,19,23,29};
long long gcd(long long x, long long y){
return y == 0 ? x: gcd(y, x%y);
}
long long gcd_ml(long long * a,long long n)
{
if(n==0)return(1);
if(n==1)return(a[0]);
return(gcd(a[0],gcd_ml(a+1,n-1)));
}
int comp(long long * x,long long * y)
{
return(*(int *)x - *(int *)y);
}
void make_test_data(int a[],int n)
{
int i,j,k;
k=0;
for(i=0;i<n-1;i++)
for(j=i+1;j<n-1;j++)
b[k++]=a[i]*a[j];
for(i=0;i<k;i++)
printf("%lld ",b[i]);
printf("\n");
}
main()
{
int i,j,NN,even_cnt,odd_min,odd_f;
long long g;
while(EOF != scanf("%d",&N) && N )
{
NN = N*(N+1)/2;
for(i=0;i<NN;i++)
scanf("%lld ",&(b[i]));
qsort(b,NN,sizeof(long long),comp);
j=0;odd_f=0;
for(i=0;i<NN;i++)
if((b[i] % 2)==0)
{ evens[j++]=b[i];
}
else
{
if(odd_f == 0)
{
odd_f = 1;
odd_min=b[i];
}
}
even_cnt=j;
g = sqrt((float)evens[0]*evens[1]/odd_min);
#ifdef DEBUGx
printf("ec:%d g:%lld\n",even_cnt,g);
#endif
printf("%lld\n",g);
for(i=0;i<even_cnt;i++)
{
evens[i]/=g;
printf("%lld ",evens[i]);
}
printf("\n");
}
return(0);
} | a.cc:45:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
45 | main()
| ^~~~
a.cc: In function 'int main()':
a.cc:56:36: error: invalid conversion from 'int (*)(long long int*, long long int*)' to '__compar_fn_t' {aka 'int (*)(const void*, const void*)'} [-fpermissive]
56 | qsort(b,NN,sizeof(long long),comp);
| ^~~~
| |
| int (*)(long long int*, long long int*)
In file included from /usr/include/c++/14/bits/std_abs.h:38,
from /usr/include/c++/14/cmath:49,
from /usr/include/c++/14/math.h:36,
from a.cc:6:
/usr/include/stdlib.h:971:34: note: initializing argument 4 of 'void qsort(void*, size_t, size_t, __compar_fn_t)'
971 | __compar_fn_t __compar) __nonnull ((1, 4));
| ~~~~~~~~~~~~~~^~~~~~~~
|
s480537333 | p00654 | C++ | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
using namespace std ;
long long a0 ;
long long t1[255] ;
long long t2[320000] ;
bool cmp(long long a,long long b){
return a < b ;
}
long long gcd(long long a,long long b){
return b?gcd(b,a%b):a;
}
int main(){
long long n ;
long long i , j , k ;
long long top1 ;
long long top2 ;
while(scanf("%lld",&n)!=EOF){
if(n == 0)
break ;
top1 = 0 ;
top2 = 0 ;
for(i = 0 ; i <= (n*(n+1)/2-1) ; i++){
long long c ;
scanf("%lld",&c) ;
if(c%2)
t2[top2++] = c ;
else
t1[top1++] = c ;
}
sort(t1,t1+top1,cmp) ;
sort(t2,t2+top2,cmp) ;
long long t = gcd(t1[0],t1[1]) ;
long long g1 = t1[0] / t ;
long long g2 = t1[1] / t ;
long long q = (long long)sqrt(t2[0]/(g1*g2)*1.0) ;
a0 = t / q ;
prlong longf("%lld\n",a0) ;
for(i = 0 ; i < n ; i++){
if(i == 0){
prlong longf("%lld",t1[i] / a0) ;
}
else
prlong longf(" %lld",t1[i] / a0) ;
}
puts("") ;
}
return 0 ;
} | a.cc: In function 'int main()':
a.cc:46:17: error: 'prlong' was not declared in this scope; did you mean 'ulong'?
46 | prlong longf("%lld\n",a0) ;
| ^~~~~~
| ulong
a.cc:49:39: error: expected ';' before 'longf'
49 | prlong longf("%lld",t1[i] / a0) ;
| ^~~~~~
| ;
a.cc:52:39: error: expected ';' before 'longf'
52 | prlong longf(" %lld",t1[i] / a0) ;
| ^~~~~~
| ;
|
s690583112 | p00654 | C++ | #include<stdio.h>
#include<math.h>
#include<map>
using namespace std;
int gcd(int m,int n)
{
int rem;
while(n>0)
{
rem = m%n;
m = n;
n = rem;
}
return m;
}
int main()
{
int n,i,b[40000],j;
while(scanf("%d",&n)!=EOF&&n)
{
map<__int64,int> mp;
for(i=0;i<n*(n+1)/2;i++)
{
scanf("%d",&b[i]);
}
for(i=0;i<n*(n+1)/2;i++)
{
for(j=i+1;j<n*(n+1)/2;j++)
{
int temp=gcd(b[i],b[j]);
if(temp==1)
continue;
if(mp[temp] == 1)
continue;
else mp[temp] = 1;
}
}
map<__int64,int>::iterator it;
for(it = mp.begin();it!=mp.end();++it)
{
if(it->first%2==0)
printf("%d\n",it->first);
}
int w=0;
for(it = mp.begin();it!=mp.end();++it)
{
if(it->first%2==0)
continue;
if(w!=0)printf(" ");
printf("%d",it->first);
w++;
}
puts("");
}
return 0;
} | a.cc: In function 'int main()':
a.cc:21:21: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
21 | map<__int64,int> mp;
| ^~~~~~~
| __ynf64
a.cc:21:32: error: template argument 1 is invalid
21 | map<__int64,int> mp;
| ^
a.cc:21:32: error: template argument 3 is invalid
a.cc:21:32: error: template argument 4 is invalid
a.cc:33:38: error: invalid types 'int[int]' for array subscript
33 | if(mp[temp] == 1)
| ^
a.cc:35:40: error: invalid types 'int[int]' for array subscript
35 | else mp[temp] = 1;
| ^
a.cc:38:32: error: template argument 3 is invalid
38 | map<__int64,int>::iterator it;
| ^
a.cc:38:32: error: template argument 4 is invalid
a.cc:38:44: error: expected initializer before 'it'
38 | map<__int64,int>::iterator it;
| ^~
a.cc:39:21: error: 'it' was not declared in this scope; did you mean 'i'?
39 | for(it = mp.begin();it!=mp.end();++it)
| ^~
| i
a.cc:39:29: error: request for member 'begin' in 'mp', which is of non-class type 'int'
39 | for(it = mp.begin();it!=mp.end();++it)
| ^~~~~
a.cc:39:44: error: request for member 'end' in 'mp', which is of non-class type 'int'
39 | for(it = mp.begin();it!=mp.end();++it)
| ^~~
a.cc:45:21: error: 'it' was not declared in this scope; did you mean 'i'?
45 | for(it = mp.begin();it!=mp.end();++it)
| ^~
| i
a.cc:45:29: error: request for member 'begin' in 'mp', which is of non-class type 'int'
45 | for(it = mp.begin();it!=mp.end();++it)
| ^~~~~
a.cc:45:44: error: request for member 'end' in 'mp', which is of non-class type 'int'
45 | for(it = mp.begin();it!=mp.end();++it)
| ^~~
|
s681529885 | p00654 | C++ | #include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
int main()
{
int n;
__int64 a[50000],b[50000],c;
while(scanf("%d",&n)!=EOF)
{
int j=0,k=0;
if(n==0)
break;
int i;
for(i=0;i<n*(n+1)/2;i++)
{
scanf("%I64d",&c);
if(c%2==0)
{
a[j]=c;
j++;
}
else
{
b[k]=c;
k++;
}
}
sort(a,a+j);
sort(b,b+k);
double num=sqrt(a[0]*a[1]/b[0]);
printf("%.0lf\n",num);
for(i=0;i<j;i++)
{
if(i!=0)
printf(" ");
printf("%.0lf",a[i]/num);
}
printf("\n");
}
return 0;
} | a.cc: In function 'int main()':
a.cc:8:9: error: '__int64' was not declared in this scope; did you mean '__ynf64'?
8 | __int64 a[50000],b[50000],c;
| ^~~~~~~
| __ynf64
a.cc:17:40: error: 'c' was not declared in this scope
17 | scanf("%I64d",&c);
| ^
a.cc:20:33: error: 'a' was not declared in this scope
20 | a[j]=c;
| ^
a.cc:25:33: error: 'b' was not declared in this scope
25 | b[k]=c;
| ^
a.cc:29:22: error: 'a' was not declared in this scope
29 | sort(a,a+j);
| ^
a.cc:30:22: error: 'b' was not declared in this scope
30 | sort(b,b+k);
| ^
|
s106868742 | p00654 | C++ | #include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
long long b[50005];
long long a[250];
int n;
long long kgcd( long long a, long long b)
{
if (a == 0) return b;
if (b == 0) return a;
if (!(a & 1) && !(b & 1))
return kgcd(a>>1, b>>1)<<1;
else if (!(b & 1))
return kgcd(a, b>>1);
else if (!(a & 1)) return kgcd(a>>1, b);
else return kgcd(abs(a - b), a > b ? b : a);
}
int main()
{
int n, i, j;
long long temp;
while( cin >> n , n ) {
for( i = 0 ; i < n * ( n + 1 ) / 2 ; ++ i )
scanf( "%lld" , &b[i] );
temp = b[0];
for( i = 1 ; i < n ; i++ ) {
temp = gcd( temp , b[i] );
}
for( j = 0 ; j < n ; ++ j ) {
a[j] = b[j] / temp;
}
if ( a[0] * a[1] == b[n] ) {
sort( a , a + n );
printf( "%lld\n" , temp );
for( j = 0 ; j < n ; ++ j ) {
if( j != n - 1 )
printf( "%lld " , a[j] );
else
printf( "%lld\n" , a[j] );
}
} else {
for( i = 3 ; i <= ( temp / 2 ); i += 2 ) {
if( temp % i == 0 ) {
for( j = 0 ; j < n ; ++ j ) {
a[j] = b[j] / ( temp / i );
}
if ( a[0] * a[1] == b[n] ) {
sort( a , a + n );
printf( "%lld\n" , ( temp / i ) );
for( j = 0 ; j < n ; ++ j ) {
if( j != n - 1 )
printf( "%lld " , a[j] );
else
printf( "%lld\n" , a[j] );
}
break;
}
}
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:29:32: error: 'gcd' was not declared in this scope; did you mean 'kgcd'?
29 | temp = gcd( temp , b[i] );
| ^~~
| kgcd
|
s793715136 | p00654 | C++ | #include<stdio.h>
#include<algorithm>
using namespace std;
__int64 n,b[100000],i,j,yu,c[100000],l,o;
int main()
{
while(scanf("%I64d",&n)!=EOF&&n)
{
l=0;
for(i=0;i<n+n*(n-1)/2;i++)
{
scanf("%I64d",&b[i]);
if(b[i]%2==0)
c[l++]=b[i];
}
sort(c,c+l);
for(i=2;i<=c[0];i=i+2)
{
for(j=0;j<l;j++)
{
if(c[j]%i!=0)
break;
}
if(j==l)
yu=i;
}
printf("%I64d\n",yu);
for(i=0;i<l-1;i++)
printf("%I64d ",c[i]/yu);
printf("%I64d\n",c[l-1]/yu);
}
return 0;
} | a.cc:4:2: error: '__int64' does not name a type; did you mean '__int64_t'?
4 | __int64 n,b[100000],i,j,yu,c[100000],l,o;
| ^~~~~~~
| __int64_t
a.cc: In function 'int main()':
a.cc:7:30: error: 'n' was not declared in this scope
7 | while(scanf("%I64d",&n)!=EOF&&n)
| ^
a.cc:9:17: error: 'l' was not declared in this scope
9 | l=0;
| ^
a.cc:10:21: error: 'i' was not declared in this scope
10 | for(i=0;i<n+n*(n-1)/2;i++)
| ^
a.cc:12:40: error: 'b' was not declared in this scope
12 | scanf("%I64d",&b[i]);
| ^
a.cc:14:33: error: 'c' was not declared in this scope
14 | c[l++]=b[i];
| ^
a.cc:16:22: error: 'c' was not declared in this scope
16 | sort(c,c+l);
| ^
a.cc:17:21: error: 'i' was not declared in this scope
17 | for(i=2;i<=c[0];i=i+2)
| ^
a.cc:19:29: error: 'j' was not declared in this scope
19 | for(j=0;j<l;j++)
| ^
a.cc:24:28: error: 'j' was not declared in this scope
24 | if(j==l)
| ^
a.cc:25:33: error: 'yu' was not declared in this scope
25 | yu=i;
| ^~
a.cc:27:34: error: 'yu' was not declared in this scope
27 | printf("%I64d\n",yu);
| ^~
a.cc:28:21: error: 'i' was not declared in this scope
28 | for(i=0;i<l-1;i++)
| ^
|
s559080244 | p00655 | C++ | import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Scanner;
import java.math.BigInteger;
import java.io.*;
class Stack{
int s[]=new int[20010];
int mins[]=new int[20010];
int maxs[]=new int[20010];
int p=0,maxp=0,minp=0;
public int size(){return p;}
public boolean empty(){return p==0;}
public void push(int v){
s[p++]=v;
if (minp == 0 || mins[minp-1] > v)mins[minp++]=v;
if (maxp == 0 || maxs[maxp-1] < v)maxs[maxp++]=v;
}
public int pop(){
int ret=s[--p];
if (mins[minp-1] == ret)minp--;
if (maxs[maxp-1] == ret)maxp--;
return ret;
}
public int getIthMin(int i){
return mins[minp-i];
}
public int getIthMax(int i){return maxs[maxp-i];}
}
class Deque{
int d[]=new int[20010];
int mind[]=new int[20010];
int maxd[]=new int[20010];
int b=0,e=0,maxb=0,maxe=0,minb=0,mine=0;
public int size(){return e-b;}
public boolean empty(){return b==e;}
public void push(int v){
d[e++]=v;
while(maxb < maxe && maxd[maxe-1] < v)maxe--;
maxd[maxe++]=v;
while(minb < mine && mind[mine-1] > v)mine--;
mind[mine++]=v;
}
public int pop(){
int ret=d[b++];
if (mind[minb] == ret)minb++;
if (maxd[maxb] == ret)maxb++;
return ret;
}
public int getIthMin(int i){return mind[minb+i-1];}
public int getIthMax(int i){return maxd[maxb+i-1];}
}
class Fimo{
Stack S;
Deque D;
Fimo(){
S=new Stack();
D=new Deque();
}
public void push(int v){
if (S.empty() && D.empty()){
S.push(v);
}else if (S.size() > D.size()){
D.push(v);
}else if (S.size() == D.size()){
int tmp=D.pop();
S.push(tmp);
D.push(v);
}
}
public int getMin(int t,int i){
if (t == 0)return S.getIthMin(i);
else return D.getIthMin(i);
}
public int getMax(int t,int i){
if (t == 0)return S.getIthMax(i);
else return D.getIthMax(i);
}
public int pop(){
int ret=-1;
if (D.empty()){
ret=S.pop();
}else if (S.size() > D.size()){
ret=S.pop();
}else if (S.size() == D.size()){
int tmp=D.pop();
ret=S.pop();
S.push(tmp);
}
return ret;
}
}
class Main{
public static void main(String []args){
Scanner in=new Scanner(System.in);
//Scanner in=new Scanner();
//System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
int q;
while(true){
q=in.nextInt();
if (q == 0)break;
Fimo a=new Fimo();
for(int i=0;i<q;i++){
int val,tmp;
tmp=in.nextInt();
switch(tmp){
case 0:
val=in.nextInt();
//System.out.print(0+" "+val+"\n");
a.push(val);
break;
case 1:
System.out.print(a.pop()+"\n");
break;
case 2:
System.out.print(a.getMin(0,1)+"\n");
break;
case 3:
System.out.print(a.getMin(1,1)+"\n");
break;
case 4:
val=in.nextInt();
System.out.print(a.getMin(0,val)+"\n");
break;
case 5:
val=in.nextInt();
System.out.print(a.getMin(1,val)+"\n");
break;
case 6:
System.out.print(a.getMax(0,1)+"\n");
break;
case 7:
System.out.print(a.getMax(1,1)+"\n");
break;
case 8:
val=in.nextInt();
System.out.print(a.getMax(0,val)+"\n");
break;
case 9:
val=in.nextInt();
System.out.print(a.getMax(1,val)+"\n");
break;
default:
break;
}
}
System.out.print("end\n");
}
}
}
/*
class Scanner {
int nextInt() {
try {
int c = System.in.read();
if (c == -1)
return c;
while (c != '-' && (c < '0' || '9' < c)) {
c = System.in.read();
if (c == -1)
return c;
}
if (c == '-')
return -nextInt();
int res = 0;
do {
res *= 10;
res += c - '0';
c = System.in.read();
} while ('0' <= c && c <= '9');
return res;
} catch (Exception e) {
return -1;
}
}
long nextLong() {
try {
int c = System.in.read();
if(c==-1)return -1;
while (c != '-' && (c < '0' || '9' < c)){
c = System.in.read();
if(c==-1)return -1;
}
if (c == '-')
return -nextLong();
long res = 0;
do {
res *= 10;
res += c - '0';
c = System.in.read();
} while ('0' <= c && c <= '9');
return res;
} catch (Exception e) {
return -1;
}
}
double nextDouble() {
return Double.parseDouble(next());
}
String next() {
try {
StringBuilder res = new StringBuilder("");
int c = System.in.read();
while (Character.isWhitespace(c))
c = System.in.read();
do {
res.append((char) c);
} while (!Character.isWhitespace(c = System.in.read()));
return res.toString();
} catch (Exception e) {
return null;
}
}
String nextLine() {
try {
StringBuilder res = new StringBuilder("");
int c = System.in.read();
while (c == '\r' || c == '\n')
c = System.in.read();
do {
res.append((char) c);
c = System.in.read();
} while (c != '\r' && c != '\n');
return res.toString();
} catch (Exception e) {
return null;
}
}
}
*/ | a.cc:1:1: error: 'import' does not name a type
1 | import java.io.FileInputStream;
| ^~~~~~
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.InputStream;
| ^~~~~~
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.util.Scanner;
| ^~~~~~
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.math.BigInteger;
| ^~~~~~
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.io.*;
| ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:12:11: error: expected ':' before 'int'
12 | public int size(){return p;}
| ^~~~
| :
a.cc:13:11: error: expected ':' before 'boolean'
13 | public boolean empty(){return p==0;}
| ^~~~~~~~
| :
a.cc:13:12: error: 'boolean' does not name a type; did you mean 'bool'?
13 | public boolean empty(){return p==0;}
| ^~~~~~~
| bool
a.cc:14:11: error: expected ':' before 'void'
14 | public void push(int v){
| ^~~~~
| :
a.cc:19:11: error: expected ':' before 'int'
19 | public int pop(){
| ^~~~
| :
a.cc:25:11: error: expected ':' before 'int'
25 | public int getIthMin(int i){
| ^~~~
| :
a.cc:28:11: error: expected ':' before 'int'
28 | public int getIthMax(int i){return maxs[maxp-i];}
| ^~~~
| :
a.cc:8:9: error: flexible array member 'Stack::s' not at end of 'class Stack'
8 | int s[]=new int[20010];
| ^
a.cc:29:2: error: expected ';' after class definition
29 | }
| ^
| ;
a.cc:8:9: error: initializer for flexible array member 'int Stack::s []'
8 | int s[]=new int[20010];
| ^
a.cc:9:9: error: initializer for flexible array member 'int Stack::mins []'
9 | int mins[]=new int[20010];
| ^~~~
a.cc:10:9: error: initializer for flexible array member 'int Stack::maxs []'
10 | int maxs[]=new int[20010];
| ^~~~
a.cc:36:11: error: expected ':' before 'int'
36 | public int size(){return e-b;}
| ^~~~
| :
a.cc:37:11: error: expected ':' before 'boolean'
37 | public boolean empty(){return b==e;}
| ^~~~~~~~
| :
a.cc:37:12: error: 'boolean' does not name a type; did you mean 'bool'?
37 | public boolean empty(){return b==e;}
| ^~~~~~~
| bool
a.cc:38:11: error: expected ':' before 'void'
38 | public void push(int v){
| ^~~~~
| :
a.cc:45:11: error: expected ':' before 'int'
45 | public int pop(){
| ^~~~
| :
a.cc:51:11: error: expected ':' before 'int'
51 | public int getIthMin(int i){return mind[minb+i-1];}
| ^~~~
| :
a.cc:52:11: error: expected ':' before 'int'
52 | public int getIthMax(int i){return maxd[maxb+i-1];}
| ^~~~
| :
a.cc:32:9: error: flexible array member 'Deque::d' not at end of 'class Deque'
32 | int d[]=new int[20010];
| ^
a.cc:53:2: error: expected ';' after class definition
53 | }
| ^
| ;
a.cc:32:9: error: initializer for flexible array member 'int Deque::d []'
32 | int d[]=new int[20010];
| ^
a.cc:33:9: error: initializer for flexible array member 'int Deque::mind []'
33 | int mind[]=new int[20010];
| ^~~~
a.cc:34:9: error: initializer for flexible array member 'int Deque::maxd []'
34 | int maxd[]=new int[20010];
| ^~~~
a.cc:62:11: error: expected ':' before 'void'
62 | public void push(int v){
| ^~~~~
| :
a.cc:73:11: error: expected ':' before 'int'
73 | public int getMin(int t,int i){
| ^~~~
| :
a.cc:77:11: error: expected ':' before 'int'
77 | public int getMax(int t,int i){
| ^~~~
| :
a.cc:81:11: error: expected ':' before 'int'
81 | public int pop(){
| ^~~~
| :
a.cc:8:9: error: flexible array member 'Stack::s' not at end of 'class Fimo'
8 | int s[]=new int[20010];
| ^
a.cc:94:2: error: expected ';' after class definition
94 | }
| ^
| ;
a.cc: In member function 'void Fimo::push(int)':
a.cc:63:15: error: 'class Stack' has no member named 'empty'
63 | if (S.empty() && D.empty()){
| ^~~~~
a.cc:63:28: error: 'class Deque' has no member named 'empty'
63 | if (S.empty() && D.empty()){
| ^~~~~
a.cc: In member function 'int Fimo::pop()':
a.cc:83:15: error: 'class Deque' has no member named 'empty'
83 | if (D.empty()){
| ^~~~~
a.cc: At global scope:
a.cc:97:11: error: expected ':' before 'static'
97 | public static void main(String []args){
| ^~~~~~~
| :
a.cc:97:29: error: 'String' has not been declared
97 | public static void main(String []args){
| ^~~~~~
a.cc:97:38: error: expected ',' or '...' before 'args'
97 | public static void main(String []args){
| ^~~~
a.cc:153:2: error: expected ';' after class definition
153 | }
| ^
| ;
a.cc: In static member function 'static void Main::main(int*)':
a.cc:98:9: error: 'Scanner' was not declared in this scope
98 | Scanner in=new Scanner(System.in);
| ^~~~~~~
a.cc:103:15: error: 'in' was not declared in this scope; did you mean 'int'?
103 | q=in.nextInt();
| ^~
| int
a.cc:105:29: error: 'Fimo::Fimo()' is private within this context
105 | Fimo a=new Fimo();
| ^
a.cc:58:5: note: declared private here
58 | Fimo(){
| ^~~~
a.cc:105:20: error: conversion from 'Fimo*' to non-scalar type 'Fimo' requested
105 | Fimo a=new Fimo();
| ^~~~~~~~~~
a.cc:116:21: error: 'System' was not declared in this scope
116 | System.out.print(a.pop()+"\n");
| ^~~~~~
a.cc:150:13: error: 'System' was not declared in this scope
150 | System.out.print("end\n");
| ^~~~~~
|
s503985638 | p00657 | C | #include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int n,m;
while(scanf("%d%d",&n,&m)!=EOF)
{
if(n==0&&m==0) continue;
printf(((n&1)&&(m&1))?"no\n":"yes\n");
}
return 0;
} | main.c:1:9: fatal error: cstdio: No such file or directory
1 | #include<cstdio>
| ^~~~~~~~
compilation terminated.
|
s808786177 | p00657 | C | #include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
int r, c;
void init()
{
while (scanf("%d%d", &r, &c), r || c)
{
if (r == 1 || c == 1) puts("no");
else puts("yes");
}
}
int main()
{
init();
return 0;
} | main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s826128663 | p00657 | C | #include <queue>
#include <vector>
#include <stack>
#include <string>
#include <cstdio>
#include <math.h>
#include <cstdlib>
#include <string.h>
#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
#define LL long long
#define PI acos(-1.0)
#define FRE freopen("c:\\users\\nitlian\\desktop\\input.txt","r",stdin)
#define FF freopen("c:\\users\\nitlian\\desktop\\output.txt", "w", stdout)
#define N 510
#define M 100100
#define inf 1000000000
int main() {
int a, b;
while (scanf ("%d%d", &a, &b), a+b) {
if ((a&1) && (b&1) ) puts("no");
else puts("yes");
}
} | main.c:1:10: fatal error: queue: No such file or directory
1 | #include <queue>
| ^~~~~~~
compilation terminated.
|
s804669470 | p00657 | C++ | #include<stdio.h>
int main(){
int w,h,n;
while(1){
scanf("%d "d",&h,&w);if(w==0&&h==0)break;
if((w*h)%2==0)printf("yes\n");
else printf("no\n");
}
return 0;
} | a.cc:8:13: warning: missing terminating " character
8 | scanf("%d "d",&h,&w);if(w==0&&h==0)break;
| ^
a.cc:8:13: error: missing terminating " character
8 | scanf("%d "d",&h,&w);if(w==0&&h==0)break;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:8:7: error: unable to find string literal operator 'operator""d' with 'const char [4]', 'long unsigned int' arguments
8 | scanf("%d "d",&h,&w);if(w==0&&h==0)break;
| ^~~~~~
a.cc:11:1: error: 'else' without a previous 'if'
11 | else printf("no\n");
| ^~~~
|
s051003276 | p00657 | C++ | #include<iostream>
#include<vector>
using namespace std;
int main(){
int r,c;
while(cin>>r>>c,r,c){
if(r*c%2==0){
cout<<"yes"<<endl;
}
else{
cout<<"no"<<endl;
}
}
}} | a.cc:19:2: error: expected declaration before '}' token
19 | }}
| ^
|
s979189619 | p00657 | C++ | #include<iostream>
using namespace std;
main(){
int r,c;while(cin>>r>>c){cout << (r+c)%2==0?"yes":"no"<<endl;}
} | a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:4:41: error: no match for 'operator==' (operand types are 'std::basic_ostream<char>' and 'int')
4 | int r,c;while(cin>>r>>c){cout << (r+c)%2==0?"yes":"no"<<endl;}
| ~~~~~~~~~~~~~~~^~~
| | |
| | int
| std::basic_ostream<char>
a.cc:4:41: note: candidate: 'operator==(int, int)' (built-in)
4 | int r,c;while(cin>>r>>c){cout << (r+c)%2==0?"yes":"no"<<endl;}
| ~~~~~~~~~~~~~~~^~~
a.cc:4:41: note: no known conversion for argument 1 from 'std::basic_ostream<char>' to 'int'
In file included from /usr/include/c++/14/iosfwd:42,
from /usr/include/c++/14/ios:40,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/postypes.h:192:5: note: candidate: 'template<class _StateT> bool std::operator==(const fpos<_StateT>&, const fpos<_StateT>&)'
192 | operator==(const fpos<_StateT>& __lhs, const fpos<_StateT>& __rhs)
| ^~~~~~~~
/usr/include/c++/14/bits/postypes.h:192:5: note: template argument deduction/substitution failed:
a.cc:4:43: note: 'std::basic_ostream<char>' is not derived from 'const std::fpos<_StateT>'
4 | int r,c;while(cin>>r>>c){cout << (r+c)%2==0?"yes":"no"<<endl;}
| ^
In file included from /usr/include/c++/14/string:43,
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:
/usr/include/c++/14/bits/allocator.h:235:5: note: candidate: 'template<class _T1, class _T2> bool std::operator==(const allocator<_CharT>&, const allocator<_T2>&)'
235 | operator==(const allocator<_T1>&, const allocator<_T2>&)
| ^~~~~~~~
/usr/include/c++/14/bits/allocator.h:235:5: note: template argument deduction/substitution failed:
a.cc:4:43: note: 'std::basic_ostream<char>' is not derived from 'const std::allocator<_CharT>'
4 | int r,c;while(cin>>r>>c){cout << (r+c)%2==0?"yes":"no"<<endl;}
| ^
In file included from /usr/include/c++/14/string:48:
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)'
441 | operator==(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:441:5: note: template argument deduction/substitution failed:
a.cc:4:43: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
4 | int r,c;while(cin>>r>>c){cout << (r+c)%2==0?"yes":"no"<<endl;}
| ^
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)'
486 | operator==(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:486:5: note: template argument deduction/substitution failed:
a.cc:4:43: note: 'std::basic_ostream<char>' is not derived from 'const std::reverse_iterator<_Iterator>'
4 | int r,c;while(cin>>r>>c){cout << (r+c)%2==0?"yes":"no"<<endl;}
| ^
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)'
1667 | operator==(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1667:5: note: template argument deduction/substitution failed:
a.cc:4:43: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
4 | int r,c;while(cin>>r>>c){cout << (r+c)%2==0?"yes":"no"<<endl;}
| ^
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator==(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)'
1737 | operator==(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator.h:1737:5: note: template argument deduction/substitution failed:
a.cc:4:43: note: 'std::basic_ostream<char>' is not derived from 'const std::move_iterator<_IteratorL>'
4 | int r,c;while(cin>>r>>c){cout << (r+c)%2==0?"yes":"no"<<endl;}
| ^
In file included from /usr/include/c++/14/bits/stl_algobase.h:64,
from /usr/include/c++/14/string:51:
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator==(const pair<_T1, _T2>&, const pair<_T1, _T2>&)'
1033 | operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/14/bits/stl_pair.h:1033:5: note: template argument deduction/substitution failed:
a.cc:4:43: note: 'std::basic_ostream<char>' is not derived from 'const std::pair<_T1, _T2>'
4 | int r,c;while(cin>>r>>c){cout << (r+c)%2==0?"yes":"no"<<endl;}
| ^
In file included from /usr/include/c++/14/bits/basic_string.h:47,
from /usr/include/c++/14/string:54:
/usr/include/c++/14/string_view:629:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, __type_identity_t<basic_string_view<_CharT, _Traits> >)'
629 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:629:5: note: template argument deduction/substitution failed:
a.cc:4:43: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
4 | int r,c;while(cin>>r>>c){cout << (r+c)%2==0?"yes":"no"<<endl;}
| ^
/usr/include/c++/14/string_view:637:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(basic_string_view<_CharT, _Traits>, basic_string_view<_CharT, _Traits>)'
637 | operator==(basic_string_view<_CharT, _Traits> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:637:5: note: template argument deduction/substitution failed:
a.cc:4:43: note: 'std::basic_ostream<char>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
4 | int r,c;while(cin>>r>>c){cout << (r+c)%2==0?"yes":"no"<<endl;}
| ^
/usr/include/c++/14/string_view:644:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator==(__type_identity_t<basic_string_view<_CharT, _Traits> >, basic_string_view<_CharT, _Traits>)'
644 | operator==(__type_identity_t<basic_string_view<_CharT, _Traits>> __x,
| ^~~~~~~~
/usr/include/c++/14/string_view:644:5: note: template argument deduction/substitution failed:
a.cc:4:43: note: mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
4 | int r,c;while(cin>>r>>c){cout << (r+c)%2==0?"yes":"no"<<endl;}
| ^
/usr/include/c++/14/bits/basic_string.h:3755:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3755 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3755:5: note: template argument deduction/substitution failed:
a.cc:4:43: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
4 | int r,c;while(cin>>r>>c){cout << (r+c)%2==0?"yes":"no"<<endl;}
| ^
/usr/include/c++/14/bits/basic_string.h:3772:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const __cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
3772 | operator==(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3772:5: note: template argument deduction/substitution failed:
a.cc:4:43: note: 'std::basic_ostream<char>' is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
4 | int r,c;while(cin>>r>>c){cout << (r+c)%2==0?"yes":"no"<<endl;}
| ^
/usr/include/c++/14/bits/basic_string.h:3819:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator==(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
3819 | operator==(const _CharT* __lhs,
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:3819:5: note: template argument deduction/substitution failed:
a.cc:4:43: note: mismatched types 'const _CharT*' and 'std::basic_ostream<char>'
4 | int r,c;while(cin>>r>>c){cout << (r+c)%2==0?"yes":"no"<<endl;}
| ^
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
from /usr/include/c++/14/string:68:
/usr/include/c++/14/tuple:2558:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator==(const tuple<_UTypes ...>&, const tuple<_Elements ...>&)'
2558 | operator==(const tuple<_TElements...>& __t,
| ^~~~~~~~
/usr/include/c++/14/tuple:2558:5: note: template argument deduction/substitution failed:
a.cc:4:43: note: 'std::basic_ostream<char>' is not derived from 'const std::tuple<_UTypes ...>'
4 | int r,c;while(cin>> |
s049908580 | p00657 | C++ | import std.stdio;
import std.string, std.conv;
import std.algorithm, std.array;
import std.typecons;
void main() {
for(;;) {
auto s = readln.split.map!(to!int).array;
int N = s[0], M = s[1];
if(N == 0 && M == 0) break;
if((N * M) % 2 == 0) writeln("yes");
else writeln("no");
}
} | a.cc:1:1: error: 'import' does not name a type
1 | import std.stdio;
| ^~~~~~
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 std.string, std.conv;
| ^~~~~~
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 std.algorithm, std.array;
| ^~~~~~
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 std.typecons;
| ^~~~~~
a.cc:4:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: '::main' must return 'int'
6 | void main() {
| ^~~~
a.cc: In function 'int main()':
a.cc:8:14: error: 'readln' was not declared in this scope
8 | auto s = readln.split.map!(to!int).array;
| ^~~~~~
a.cc:10:18: error: 'M' was not declared in this scope
10 | if(N == 0 && M == 0) break;
| ^
a.cc:11:13: error: 'M' was not declared in this scope
11 | if((N * M) % 2 == 0) writeln("yes");
| ^
a.cc:11:26: error: 'writeln' was not declared in this scope
11 | if((N * M) % 2 == 0) writeln("yes");
| ^~~~~~~
a.cc:12:10: error: 'writeln' was not declared in this scope
12 | else writeln("no");
| ^~~~~~~
|
s343276184 | p00657 | C++ | #include<stdio.h>
main(){
int r,c;
while(1){
} | a.cc:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
2 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:6:2: error: expected '}' at end of input
6 | }
| ^
a.cc:2:7: note: to match this '{'
2 | main(){
| ^
|
s508640657 | p00659 | C | #include <stdio.h>
#include <string.h>
typedef struct {
char name[12];
int disp_num;
int disp_time[30];
int points;
} kyara_t;
int kyara_num;
kyara_t kyara[20];
int all_disp_num[30];
int main(void) {
int i,j;
int min_id;
while(1) {
scanf("%d",&kyara_num);
if(kyara_num==0)break;
memset(kyara,0,sizeof(kyara));
memset(all_disp_num,0,sizeof(all_disp_num));
for(i=0;i<kyara_num;i++) {
scanf("%s%d",kyara[i].name,&kyara[i].disp_num);
for(j=0;j<kyara[i].disp_num;j++) {
scanf("%d",&kyara[i].disp_time[j]);
}
}
for(i=0;i<kyara_num;i++) {
for(j=0;j<kyara[i].disp_num;j++) {
kyara[i].points+=kyara_num;
all_disp_num[kyara[i].disp_time[j]]++;
}
}
for(i=0;i<kyara_num;i++) {
for(j=0;j<kyara[i].disp_num;j++) {
kyara[i].points-=all_disp_num[kyara[i].disp_time[j]]-1;
}
}
for(i=1,min_id=0;i<kyara_num;i++) {
if(kyara[i].points<kyara[min_id].points) {
min_id=i;
} else if(kyara[i].points==kyara[min_id].points) {
if(strcmpi(kyara[i].name,kyara[min_id].name)>0) {
min_id=i;
}
}
}
printf("%d %s\n",kyara[min_id].points,kyara[min_id].name);
}
return 0;
} | main.c: In function 'main':
main.c:45:36: error: implicit declaration of function 'strcmpi'; did you mean 'strcmp'? [-Wimplicit-function-declaration]
45 | if(strcmpi(kyara[i].name,kyara[min_id].name)>0) {
| ^~~~~~~
| strcmp
|
s088508978 | p00659 | C++ | #error "AAA"
#include <cstdio>
#include <cassert>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <string>
#include <stdexcept>
// using Tsurai()=std::out_of_range;
struct Tsurai: public std::out_of_range {
Tsurai(): std::out_of_range("") {}
};
void apply(int &lhs, char op, int rhs) {
switch (op) {
case '+':
lhs += rhs;
break;
case '-':
lhs -= rhs;
break;
case '*':
lhs *= rhs;
break;
}
if (!(0 <= lhs && lhs < 1024))
throw Tsurai();
}
int parse_bin(const std::string &s, size_t &i) {
int res=0;
while (i < s.length()) {
res = res*10+s[i]-'0';
++i;
if (res >= 1024) throw Tsurai();
}
assert(res < 1024);
return res;
}
int parse(
const std::string &s, size_t &i,
const std::vector<std::string> &ops={"+-", "*", ""}, size_t prec=0) {
if (prec == ops.size()) {
if (s.at(i) == '(') {
++i;
if (s.at(i) == ')') throw Tsurai();
size_t j=i;
(void)parse_bin(s, j);
if (s.at(j) == ')') throw Tsurai();
int res=parse(s, i, ops, 0);
++i;
if (s.at(i) != ')')
throw Tsurai();
return res;
}
if (isdigit(s.at(i))) {
return parse_bin(s, i);
}
throw Tsurai();
}
int lhs=parse(s, i, ops, ++prec);
while (true) {
char op=s.at(i);
if (!(op == '+' || op == '-' || op == '*' || op == ')'))
throw Tsurai();
if (!std::count(ops[prec].begin(), ops[prec].end(), op))
break;
int rhs=parse(s, ++i, ops, prec+1);
apply(lhs, op, rhs);
}
return lhs;
}
int rec(std::string &s, std::vector<size_t> &dot) {
if (dot.empty()) {
try {
size_t i=0;
return parse(s, i);
} catch (Tsurai) {
return -1;
}
}
size_t x=dot.back();
dot.pop_back();
int res=-1;
for (char ch: {'0', '1', '+', '-', '*', '(', ')'}) {
s[x] = ch;
res = std::max(res, rec(s, dot));
}
s[x] = '.';
dot.push_back(x);
return res;
}
int main() {
char buf[128];
scanf("%s", buf);
std::string s=buf;
std::vector<size_t> dot;
for (size_t i=0; i<s.length(); ++i) {
if (s[i] == '.')
dot.push_back(i);
}
printf("%d\n", rec(s, dot));
}
| a.cc:1:2: error: #error "AAA"
1 | #error "AAA"
| ^~~~~
|
s444916063 | p00659 | C++ | #error "A"
#include <cstdio>
#include <cassert>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <string>
#include <stdexcept>
//#define fprintf(...) void(0)
struct Tsurai: public std::out_of_range {
Tsurai(int d): std::out_of_range(std::string("L: ")+std::to_string(d)) {}
};
void apply(int &lhs, char op, int rhs) {
switch (op) {
case '+':
lhs += rhs;
break;
case '-':
lhs -= rhs;
break;
case '*':
lhs *= rhs;
break;
}
if (!(0 <= lhs && lhs < 1024))
throw Tsurai(__LINE__);
}
int parse_bin(const std::string &s, size_t &i) {
int res=0;
while (i < s.length()) {
res = res*2+s[i]-'0';
++i;
if (res >= 1024) throw Tsurai(__LINE__);
}
assert(res < 1024);
return res;
}
int parse(
const std::string &s, size_t &i,
const std::vector<std::string> &ops={"+-", "*", ""}, size_t prec=0) {
fprintf(stderr, "C%zu\n", i);
fprintf(stderr, "S: %s\n", s.c_str());
if (prec == ops.size()) {
if (s.at(i) == '(') {
++i;
if (s.at(i) == ')') throw Tsurai(__LINE__);
size_t j=i;
(void)parse_bin(s, j);
if (s.at(j) == ')') throw Tsurai(__LINE__);
int res=parse(s, i, ops, 0);
if (s.at(i) != ')')
throw Tsurai(__LINE__);
++i;
return res;
}
fprintf(stderr, "%d\n", __LINE__);
if (isdigit(s.at(i))) {
fprintf(stderr, "%d\n", __LINE__);
return parse_bin(s, i);
}
throw Tsurai(__LINE__);
}
int lhs=parse(s, i, ops, prec+1);
while (i < s.length()) {
char op=s.at(i);
if (!(op == '+' || op == '-' || op == '*'))
throw Tsurai(__LINE__);
if (!std::count(ops[prec].begin(), ops[prec].end(), op))
break;
int rhs=parse(s, ++i, ops, prec+1);
apply(lhs, op, rhs);
}
return lhs;
}
int rec(std::string &s, std::vector<size_t> &dot) {
if (dot.empty()) {
try {
size_t i=0;
return parse(s, i);
if (i != s.length()) return -1;
} catch (std::out_of_range x) {
fprintf(stderr, "Tsurai on %s\n", x.what());
return -1;
}
}
size_t x=dot.back();
dot.pop_back();
int res=-1;
for (char ch: {'0', '1', '+', '-', '*', '(', ')'}) {
s[x] = ch;
res = std::max(res, rec(s, dot));
}
s[x] = '.';
dot.push_back(x);
return res;
}
int main() {
char buf[128];
scanf("%s", buf);
std::string s=buf;
std::vector<size_t> dot;
for (size_t i=0; i<s.length(); ++i) {
if (s[i] == '.')
dot.push_back(i);
}
printf("%d\n", rec(s, dot));
}
| a.cc:1:2: error: #error "A"
1 | #error "A"
| ^~~~~
|
s443621624 | p00659 | C++ | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>
using namespace std;
typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;
struct Edge{int to,from,cost;};
#ifdef DEBUGLOCAL
#define debug cout
#else
stringstream __ss__;
#define debug __ss__
#endif
template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) debug << *i << " "; debug << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
#define rep(i,n) for(int i=0;i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;+--)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);+--)
#define rep0(i,n) for(i=0;i<(n);++i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define mp make_pair
#define pb push_back
#define ss stringstream
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;
const int INF = 2147483647;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int dx[]={1,-1,0,0,1,-1,1,-1,0};
const int dy[]={0,0,1,-1,1,-1,-1,1,0};
map<int,string> name;
int time[40][40];
int pt[40][40];
int main() {
int n;
for(;;){
cin>>n;
if(n==0)break;
name.clear();
memset(time,0,sizeof(time));
memset(pt,0,sizeof(pt));
rep(i,n){
string nm;
cin>>nm;
name[i]=nm;
int m;
cin>>m;
rep(j,m){
int x;
cin>>x;
time[i][x]=1;
}
}
rep(i,n){
rep(j,30){
if(time[i][j]==0)continue;
int count=0;
rep(k,n){
count+=time[k][j];
}
pt[i][j]=n+1-count;
}
}
int mn=INF,res=0;
rep(i,n){
int count=0;
rep(j,30)count+=pt[i][j];
if(mn>count){
res=i;
mn=count;
}else if(mn==count){
if(name[res]>name[i]){
res=i;
}
}
}
cout<<mn<<" "<<name[res]<<endl;
}
return 0;
} | a.cc:61:16: error: 'int time [40][40]' redeclared as different kind of entity
61 | int time[40][40];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:6:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:70:38: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
70 | memset(time,0,sizeof(time));
| ~^~~~~
a.cc:70:24: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive]
70 | memset(time,0,sizeof(time));
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
In file included from /usr/include/c++/14/cstring:43,
from a.cc:3:
/usr/include/string.h:61:28: note: initializing argument 1 of 'void* memset(void*, int, size_t)'
61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
| ~~~~~~^~~
a.cc:81:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
81 | time[i][x]=1;
| ^
a.cc:81:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
81 | time[i][x]=1;
| ^
a.cc:81:43: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)x)))'
81 | time[i][x]=1;
| ~~~~~~~~~~^~
a.cc:86:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
86 | if(time[i][j]==0)continue;
| ^
a.cc:86:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
86 | if(time[i][j]==0)continue;
| ^
a.cc:89:54: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | count+=time[k][j];
| ^
a.cc:89:57: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | count+=time[k][j];
| ^
a.cc:89:46: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | count+=time[k][j];
| ~~~~~^~~~~~~~~~~~
a.cc:89:46: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
89 | count+=time[k][j];
| ~~~~~^~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s650663097 | p00659 | C++ | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>
using namespace std;
typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;
struct Edge{int to,from,cost;};
#define debug cout
template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) debug << *i << " "; debug << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
#define rep(i,n) for(int i=0;i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;+--)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);+--)
#define rep0(i,n) for(i=0;i<(n);++i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define mp make_pair
#define pb push_back
#define ss stringstream
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;
const int INF = 2147483647;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int dx[]={1,-1,0,0,1,-1,1,-1,0};
const int dy[]={0,0,1,-1,1,-1,-1,1,0};
map<int,string> name;
int time[40][40];
int pt[40][40];
int main() {
int n;
for(;;){
cin>>n;
if(n==0)break;
name.clear();
memset(time,0,sizeof(time));
memset(pt,0,sizeof(pt));
rep(i,n){
string nm;
cin>>nm;
name[i]=nm;
int m;
cin>>m;
rep(j,m){
int x;
cin>>x;
time[i][x]=1;
}
}
rep(i,n){
rep(j,30){
if(time[i][j]==0)continue;
int count=0;
rep(k,n){
count+=time[k][j];
}
pt[i][j]=n+1-count;
}
}
int mn=INF,res=0;
rep(i,n){
int count=0;
rep(j,30)count+=pt[i][j];
if(mn>count){
res=i;
mn=count;
}else if(mn==count){
if(name[res]>name[i]){
res=i;
}
}
}
cout<<mn<<" "<<name[res]<<endl;
}
return 0;
} | a.cc:56:16: error: 'int time [40][40]' redeclared as different kind of entity
56 | int time[40][40];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:6:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:65:38: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
65 | memset(time,0,sizeof(time));
| ~^~~~~
a.cc:65:24: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive]
65 | memset(time,0,sizeof(time));
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
In file included from /usr/include/c++/14/cstring:43,
from a.cc:3:
/usr/include/string.h:61:28: note: initializing argument 1 of 'void* memset(void*, int, size_t)'
61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
| ~~~~~~^~~
a.cc:76:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
76 | time[i][x]=1;
| ^
a.cc:76:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
76 | time[i][x]=1;
| ^
a.cc:76:43: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)x)))'
76 | time[i][x]=1;
| ~~~~~~~~~~^~
a.cc:81:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
81 | if(time[i][j]==0)continue;
| ^
a.cc:81:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
81 | if(time[i][j]==0)continue;
| ^
a.cc:84:54: warning: pointer to a function used in arithmetic [-Wpointer-arith]
84 | count+=time[k][j];
| ^
a.cc:84:57: warning: pointer to a function used in arithmetic [-Wpointer-arith]
84 | count+=time[k][j];
| ^
a.cc:84:46: warning: pointer to a function used in arithmetic [-Wpointer-arith]
84 | count+=time[k][j];
| ~~~~~^~~~~~~~~~~~
a.cc:84:46: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
84 | count+=time[k][j];
| ~~~~~^~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s156966724 | p00659 | C++ | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;+--)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);+--)
#define rep0(i,n) for(i=0;i<(n);++i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
const int INF = 2147483647;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int dx[]={1,-1,0,0,1,-1,1,-1,0};
const int dy[]={0,0,1,-1,1,-1,-1,1,0};
map<int,string> name;
int time[40][40];
int pt[40][40];
int main() {
int n;
for(;;){
cin>>n;
if(n==0)break;
name.clear();
memset(time,0,sizeof(time));
memset(pt,0,sizeof(pt));
rep(i,n){
string nm;
cin>>nm;
name[i]=nm;
int m;
cin>>m;
rep(j,m){
int x;
cin>>x;
time[i][x]=1;
}
}
rep(i,n){
rep(j,30){
if(time[i][j]==0)continue;
int count=0;
rep(k,n){
count+=time[k][j];
}
pt[i][j]=n+1-count;
}
}
int mn=INF,res=0;
rep(i,n){
int count=0;
rep(j,30)count+=pt[i][j];
if(mn>count){
res=i;
mn=count;
}else if(mn==count){
if(name[res]>name[i]){
res=i;
}
}
}
cout<<mn<<" "<<name[res]<<endl;
}
return 0;
} | a.cc:39:16: error: 'int time [40][40]' redeclared as different kind of entity
39 | int time[40][40];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:6:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:48:38: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
48 | memset(time,0,sizeof(time));
| ~^~~~~
a.cc:48:24: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive]
48 | memset(time,0,sizeof(time));
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
In file included from /usr/include/c++/14/cstring:43,
from a.cc:3:
/usr/include/string.h:61:28: note: initializing argument 1 of 'void* memset(void*, int, size_t)'
61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
| ~~~~~~^~~
a.cc:59:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | time[i][x]=1;
| ^
a.cc:59:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
59 | time[i][x]=1;
| ^
a.cc:59:43: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)x)))'
59 | time[i][x]=1;
| ~~~~~~~~~~^~
a.cc:64:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
64 | if(time[i][j]==0)continue;
| ^
a.cc:64:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
64 | if(time[i][j]==0)continue;
| ^
a.cc:67:54: warning: pointer to a function used in arithmetic [-Wpointer-arith]
67 | count+=time[k][j];
| ^
a.cc:67:57: warning: pointer to a function used in arithmetic [-Wpointer-arith]
67 | count+=time[k][j];
| ^
a.cc:67:46: warning: pointer to a function used in arithmetic [-Wpointer-arith]
67 | count+=time[k][j];
| ~~~~~^~~~~~~~~~~~
a.cc:67:46: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
67 | count+=time[k][j];
| ~~~~~^~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s716674081 | p00659 | C++ | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>
using namespace std;
typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<string> vstring;
typedef vector<pint> vpint;
struct Edge{int to,from,cost;};
#ifdef DEBUGLOCAL
#define debug cout
#else
stringstream __ss__;
#define debug __ss__
#endif
template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) debug << *i << " "; debug << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
#define rep(i,n) for(int i=0;i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;+--)
#define repn(i,m,n) for(int i=(m);i<=(n);++i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);+--)
#define rep0(i,n) for(i=0;i<(n);++i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define mp make_pair
#define pb push_back
#define ss stringstream
#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;
const int INF = 2147483647;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int dx[]={1,-1,0,0,1,-1,1,-1,0};
const int dy[]={0,0,1,-1,1,-1,-1,1,0};
//map<int,string> name;
int time[40][40];
int pt[40][40];
int main() {
int n;
for(;;){
cin>>n;
if(n==0)break;
// name.clear();
memset(time,0,sizeof(time));
memset(pt,0,sizeof(pt));
rep(i,n){
string nm;
cin>>nm;
// name[i]=nm;
int m;
cin>>m;
rep(j,m){
int x;
cin>>x;
time[i][x]=1;
}
}
rep(i,n){
rep(j,30){
if(time[i][j]==0)continue;
int count=0;
rep(k,n){
count+=time[k][j];
}
pt[i][j]=n+1-count;
}
}
int mn=INF,res=0;
rep(i,n){
int count=0;
rep(j,30)count+=pt[i][j];
if(mn>count){
res=i;
mn=count;
// }else if(mn==count){
// if(name[res]>name[i]){
// res=i;
// }
}
}
// cout<<mn<<" "<<name[res]<<endl;
cout<<mn<<endl;
}
return 0;
} | a.cc:61:16: error: 'int time [40][40]' redeclared as different kind of entity
61 | int time[40][40];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:6:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:70:38: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
70 | memset(time,0,sizeof(time));
| ~^~~~~
a.cc:70:24: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive]
70 | memset(time,0,sizeof(time));
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
In file included from /usr/include/c++/14/cstring:43,
from a.cc:3:
/usr/include/string.h:61:28: note: initializing argument 1 of 'void* memset(void*, int, size_t)'
61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
| ~~~~~~^~~
a.cc:81:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
81 | time[i][x]=1;
| ^
a.cc:81:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
81 | time[i][x]=1;
| ^
a.cc:81:43: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)x)))'
81 | time[i][x]=1;
| ~~~~~~~~~~^~
a.cc:86:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
86 | if(time[i][j]==0)continue;
| ^
a.cc:86:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
86 | if(time[i][j]==0)continue;
| ^
a.cc:89:54: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | count+=time[k][j];
| ^
a.cc:89:57: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | count+=time[k][j];
| ^
a.cc:89:46: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | count+=time[k][j];
| ~~~~~^~~~~~~~~~~~
a.cc:89:46: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
89 | count+=time[k][j];
| ~~~~~^~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s932599513 | p00659 | C++ | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>
using namespace std;
//typedef long long Int;
//typedef vector<int> vint;
//typedef pair<int,int> pint;
//typedef vector<string> vstring;
//typedef vector<pint> vpint;
//struct Edge{int to,from,cost;};
//#ifdef DEBUGLOCAL
//#define debug cout
//#else
//stringstream __ss__;
//#define debug __ss__
//#endif
//template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) debug << *i << " "; debug << endl; }
//template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
//template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
//#define rep(i,n) for(int i=0;i<(n);++i)
//#define repd(i,n) for(int i=(n)-1;i>=0;+--)
//#define repn(i,m,n) for(int i=(m);i<=(n);++i)
//#define repnd(i,m,n) for(int i=(n)-1;i>=(m);+--)
//#define rep0(i,n) for(i=0;i<(n);++i)
//#define all(n) n.begin(),n.end()
//#define sz(n) ((int)(n).size())
//#define mp make_pair
//#define pb push_back
//#define ss stringstream
//#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;
const int INF = 2147483647;
//const double EPS = 1e-10;
//const double PI = acos(-1.0);
//const int dx[]={1,-1,0,0,1,-1,1,-1,0};
//const int dy[]={0,0,1,-1,1,-1,-1,1,0};
map<int,string> name;
int time[40][40];
int pt[40][40];
int main() {
int n;
for(;;){
cin>>n;
if(n==0)break;
name.clear();
memset(time,0,sizeof(time));
memset(pt,0,sizeof(pt));
for(int i=0;i<n;++i){
string nm;
cin>>nm;
name[i]=nm;
int m;
cin>>m;
for(int j=0;j<m;++j){
int x;
cin>>x;
time[i][x]=1;
}
}
for(int i=0;i<n;++i){
for(int j=0;j<30;++j){
if(time[i][j]==0)continue;
int count=0;
for(int k=0;k<n;++k){
count+=time[k][j];
}
pt[i][j]=n+1-count;
}
}
int mn=INF,res=0;
for(int i=0;i<n;++i){
int count=0;
for(int j=0;j<30;++j)count+=pt[i][j];
if(mn>count){
res=i;
mn=count;
}else if(mn==count){
if(name[res]>name[i]){
res=i;
}
}
}
cout<<mn<<" "<<name[res]<<endl;
}
return 0;
} | a.cc:61:16: error: 'int time [40][40]' redeclared as different kind of entity
61 | int time[40][40];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:6:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:70:38: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
70 | memset(time,0,sizeof(time));
| ~^~~~~
a.cc:70:24: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive]
70 | memset(time,0,sizeof(time));
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
In file included from /usr/include/c++/14/cstring:43,
from a.cc:3:
/usr/include/string.h:61:28: note: initializing argument 1 of 'void* memset(void*, int, size_t)'
61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
| ~~~~~~^~~
a.cc:81:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
81 | time[i][x]=1;
| ^
a.cc:81:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
81 | time[i][x]=1;
| ^
a.cc:81:43: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)x)))'
81 | time[i][x]=1;
| ~~~~~~~~~~^~
a.cc:86:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
86 | if(time[i][j]==0)continue;
| ^
a.cc:86:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
86 | if(time[i][j]==0)continue;
| ^
a.cc:89:54: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | count+=time[k][j];
| ^
a.cc:89:57: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | count+=time[k][j];
| ^
a.cc:89:46: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | count+=time[k][j];
| ~~~~~^~~~~~~~~~~~
a.cc:89:46: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
89 | count+=time[k][j];
| ~~~~~^~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s648379639 | p00659 | C++ | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>
using namespace std;
//typedef long long Int;
//typedef vector<int> vint;
//typedef pair<int,int> pint;
//typedef vector<string> vstring;
//typedef vector<pint> vpint;
//struct Edge{int to,from,cost;};
//#ifdef DEBUGLOCAL
//#define debug cout
//#else
//stringstream __ss__;
//#define debug __ss__
//#endif
//template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) debug << *i << " "; debug << endl; }
//template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
//template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
//#define rep(i,n) for(int i=0;i<(n);++i)
//#define repd(i,n) for(int i=(n)-1;i>=0;+--)
//#define repn(i,m,n) for(int i=(m);i<=(n);++i)
//#define repnd(i,m,n) for(int i=(n)-1;i>=(m);+--)
//#define rep0(i,n) for(i=0;i<(n);++i)
//#define all(n) n.begin(),n.end()
//#define sz(n) ((int)(n).size())
//#define mp make_pair
//#define pb push_back
//#define ss stringstream
//#define PUTLINE debug<<"LINE:"<<__LINE__<<endl;
const int INF = 2147483647;
//const double EPS = 1e-10;
//const double PI = acos(-1.0);
//const int dx[]={1,-1,0,0,1,-1,1,-1,0};
//const int dy[]={0,0,1,-1,1,-1,-1,1,0};
map<int,string> name;
int time[40][40];
int point[40][40];
int main() {
int n;
for(;;){
cin>>n;
if(n==0)break;
name.clear();
memset(time,0,sizeof(time));
memset(point,0,sizeof(point));
for(int i=0;i<n;++i){
string nm;
cin>>nm;
name[i]=nm;
int m;
cin>>m;
for(int j=0;j<m;++j){
int x;
cin>>x;
time[i][x]=1;
}
}
for(int i=0;i<n;++i){
for(int j=0;j<30;++j){
if(time[i][j]==0)continue;
int count=0;
for(int k=0;k<n;++k){
count+=time[k][j];
}
point[i][j]=n+1-count;
}
}
int mn=INF,res=0;
for(int i=0;i<n;++i){
int count=0;
for(int j=0;j<30;++j)count+=point[i][j];
if(mn>count){
res=i;
mn=count;
}else if(mn==count){
if(name[res]>name[i]){
res=i;
}
}
}
cout<<mn<<" "<<name[res]<<endl;
}
return 0;
} | a.cc:61:16: error: 'int time [40][40]' redeclared as different kind of entity
61 | int time[40][40];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:6:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:70:38: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
70 | memset(time,0,sizeof(time));
| ~^~~~~
a.cc:70:24: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive]
70 | memset(time,0,sizeof(time));
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
In file included from /usr/include/c++/14/cstring:43,
from a.cc:3:
/usr/include/string.h:61:28: note: initializing argument 1 of 'void* memset(void*, int, size_t)'
61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
| ~~~~~~^~~
a.cc:81:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
81 | time[i][x]=1;
| ^
a.cc:81:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
81 | time[i][x]=1;
| ^
a.cc:81:43: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)x)))'
81 | time[i][x]=1;
| ~~~~~~~~~~^~
a.cc:86:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
86 | if(time[i][j]==0)continue;
| ^
a.cc:86:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
86 | if(time[i][j]==0)continue;
| ^
a.cc:89:54: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | count+=time[k][j];
| ^
a.cc:89:57: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | count+=time[k][j];
| ^
a.cc:89:46: warning: pointer to a function used in arithmetic [-Wpointer-arith]
89 | count+=time[k][j];
| ~~~~~^~~~~~~~~~~~
a.cc:89:46: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
89 | count+=time[k][j];
| ~~~~~^~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s974113573 | p00659 | C++ | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>
using namespace std;
map<int,string> name;
int time[40][40];
int point[40][40];
int main() {
int n;
for(;;){
cin>>n;
if(n==0)break;
name.clear();
memset(time,0,sizeof(time));
memset(point,0,sizeof(point));
for(int i=0;i<n;++i){
string nm;
cin>>nm;
name[i]=nm;
int m;
cin>>m;
for(int j=0;j<m;++j){
int x;
cin>>x;
time[i][x]=1;
}
}
for(int i=0;i<n;++i){
for(int j=0;j<30;++j){
if(time[i][j]==0)continue;
int cnt=0;
for(int k=0;k<n;++k){
cnt+=time[k][j];
}
point[i][j]=n+1-cnt;
}
}
int mn=100100100,res=0;
for(int i=0;i<n;++i){
int cnt=0;
for(int j=0;j<30;++j)cnt+=point[i][j];
if(mn>cnt){
res=i;
mn=cnt;
}else if(mn==cnt){
if(name[res]>name[i]){
res=i;
}
}
}
cout<<mn<<" "<<name[res]<<endl;
}
return 0;
} | a.cc:23:16: error: 'int time [40][40]' redeclared as different kind of entity
23 | int time[40][40];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:6:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:32:38: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
32 | memset(time,0,sizeof(time));
| ~^~~~~
a.cc:32:24: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive]
32 | memset(time,0,sizeof(time));
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
In file included from /usr/include/c++/14/cstring:43,
from a.cc:3:
/usr/include/string.h:61:28: note: initializing argument 1 of 'void* memset(void*, int, size_t)'
61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
| ~~~~~~^~~
a.cc:43:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
43 | time[i][x]=1;
| ^
a.cc:43:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
43 | time[i][x]=1;
| ^
a.cc:43:43: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)x)))'
43 | time[i][x]=1;
| ~~~~~~~~~~^~
a.cc:48:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
48 | if(time[i][j]==0)continue;
| ^
a.cc:48:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
48 | if(time[i][j]==0)continue;
| ^
a.cc:51:52: warning: pointer to a function used in arithmetic [-Wpointer-arith]
51 | cnt+=time[k][j];
| ^
a.cc:51:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
51 | cnt+=time[k][j];
| ^
a.cc:51:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
51 | cnt+=time[k][j];
| ~~~^~~~~~~~~~~~
a.cc:51:44: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
51 | cnt+=time[k][j];
| ~~~^~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s790766743 | p00659 | C++ | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>
using namespace std;
map<int,string> namee;
int time[40][40];
int point[40][40];
int main() {
int n;
for(;;){
cin>>n;
if(n==0)break;
namee.clear();
memset(time,0,sizeof(time));
memset(point,0,sizeof(point));
for(int i=0;i<n;++i){
string nm;
cin>>nm;
namee[i]=nm;
int m;
cin>>m;
for(int j=0;j<m;++j){
int x;
cin>>x;
time[i][x]=1;
}
}
for(int i=0;i<n;++i){
for(int j=0;j<30;++j){
if(time[i][j]==0)continue;
int cnt=0;
for(int k=0;k<n;++k){
cnt+=time[k][j];
}
point[i][j]=n+1-cnt;
}
}
int mn=100100100,res=0;
for(int i=0;i<n;++i){
int cnt=0;
for(int j=0;j<30;++j)cnt+=point[i][j];
if(mn>cnt){
res=i;
mn=cnt;
}else if(mn==cnt){
if(namee[res]>namee[i]){
res=i;
}
}
}
cout<<mn<<" "<<namee[res]<<endl;
}
return 0;
} | a.cc:23:16: error: 'int time [40][40]' redeclared as different kind of entity
23 | int time[40][40];
| ^
In file included from /usr/include/pthread.h:23,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr-default.h:35,
from /usr/include/x86_64-linux-gnu/c++/14/bits/gthr.h:157,
from /usr/include/c++/14/ext/atomicity.h:35,
from /usr/include/c++/14/bits/ios_base.h:39,
from /usr/include/c++/14/ios:44,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:6:
/usr/include/time.h:76:15: note: previous declaration 'time_t time(time_t*)'
76 | extern time_t time (time_t *__timer) __THROW;
| ^~~~
a.cc: In function 'int main()':
a.cc:32:38: error: ISO C++ forbids applying 'sizeof' to an expression of function type [-fpermissive]
32 | memset(time,0,sizeof(time));
| ~^~~~~
a.cc:32:24: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'void*' [-fpermissive]
32 | memset(time,0,sizeof(time));
| ^~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
In file included from /usr/include/c++/14/cstring:43,
from a.cc:3:
/usr/include/string.h:61:28: note: initializing argument 1 of 'void* memset(void*, int, size_t)'
61 | extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
| ~~~~~~^~~
a.cc:43:39: warning: pointer to a function used in arithmetic [-Wpointer-arith]
43 | time[i][x]=1;
| ^
a.cc:43:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
43 | time[i][x]=1;
| ^
a.cc:43:43: error: assignment of read-only location '*(time + (((sizetype)i) + ((sizetype)x)))'
43 | time[i][x]=1;
| ~~~~~~~~~~^~
a.cc:48:42: warning: pointer to a function used in arithmetic [-Wpointer-arith]
48 | if(time[i][j]==0)continue;
| ^
a.cc:48:45: warning: pointer to a function used in arithmetic [-Wpointer-arith]
48 | if(time[i][j]==0)continue;
| ^
a.cc:51:52: warning: pointer to a function used in arithmetic [-Wpointer-arith]
51 | cnt+=time[k][j];
| ^
a.cc:51:55: warning: pointer to a function used in arithmetic [-Wpointer-arith]
51 | cnt+=time[k][j];
| ^
a.cc:51:44: warning: pointer to a function used in arithmetic [-Wpointer-arith]
51 | cnt+=time[k][j];
| ~~~^~~~~~~~~~~~
a.cc:51:44: error: invalid conversion from 'time_t (*)(time_t*) noexcept' {aka 'long int (*)(long int*) noexcept'} to 'int' [-fpermissive]
51 | cnt+=time[k][j];
| ~~~^~~~~~~~~~~~
| |
| time_t (*)(time_t*) noexcept {aka long int (*)(long int*) noexcept}
|
s230798209 | p00660 | C++ | a[3]=="#..-..#" &&
a[4]=="#.|.|.#" &&
a[5]=="#..-..#") return 6;
if(a[3]=="#.....#" &&
a[5]=="#.....#") return 7;
if(a[1]=="#..-..#" &&
a[2]=="#.|.|.#" &&
a[3]=="#..-..#" &&
a[4]=="#.|.|.#" &&
a[5]=="#..-..#") return 8;
if(a[1]=="#..-..#" &&
a[2]=="#.|.|.#" &&
a[3]=="#..-..#" &&
a[4]=="#...|.#" &&
a[5]=="#..-..#") return 9;
return -1;
} | a.cc:1:6: error: 'a' does not name a type
1 | a[3]=="#..-..#" &&
| ^
a.cc:5:3: error: expected unqualified-id before 'if'
5 | if(a[3]=="#.....#" &&
| ^~
a.cc:8:3: error: expected unqualified-id before 'if'
8 | if(a[1]=="#..-..#" &&
| ^~
a.cc:14:3: error: expected unqualified-id before 'if'
14 | if(a[1]=="#..-..#" &&
| ^~
a.cc:19:3: error: expected unqualified-id before 'return'
19 | return -1;
| ^~~~~~
a.cc:20:1: error: expected declaration before '}' token
20 | }
| ^
|
s292724781 | p00660 | C++ | #include <vector>
#include <algorithm>
using namespace std;
int parse(const vector<string>& subgrid)
{
unsigned s = 0;
s |= ((subgrid[1][3] == '-') << 6);
s |= ((subgrid[2][2] == '|') << 5);
s |= ((subgrid[2][4] == '|') << 4);
s |= ((subgrid[3][3] == '-') << 3);
s |= ((subgrid[4][2] == '|') << 2);
s |= ((subgrid[4][4] == '|') << 1);
s |= ((subgrid[5][3] == '-') << 0);
switch (s) {
case 19: return 1;
case 93: return 2;
case 91: return 3;
case 58: return 4;
case 107: return 5;
case 111: return 6;
case 82: return 7;
case 127: return 8;
case 123: return 9;
default: throw "unrecognized char";
}
}
void lr(vector<string>& subgrid)
{
for (vector<string>::iterator it = subgrid.begin(); it != subgrid.end(); ++it) {
reverse(it->begin(), it->end());
}
}
void ud(vector<string>& subgrid)
{
reverse(subgrid.begin(), subgrid.end());
}
void rot(vector<string>& subgrid)
{
const vector<string> src(subgrid);
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 7; j++) {
if (src[i][j] == '|') {
subgrid[6-j][i] = '-';
} else if (src[i][j] == '-') {
subgrid[6-j][i] = '|';
} else {
subgrid[6-j][i] = src[i][j];
}
}
}
}
int main()
{
string line;
while (cin >> line && line != "0") {
vector<string> lines(1, line);
for (int i = 1; i < 21; i++) {
cin >> line;
lines.push_back(line);
}
int d[2][6];
for (int k = 0; k < 2; k++) {
static const int tbl[][2] = {{0,7},{7,0},{7,7},{7,14},{7,21},{14,7}};
for (int i = 0; i < 6; i++) {
vector<string> grid;
for (int j = 0; j < 7; j++) {
grid.push_back(lines[tbl[i][0]+j].substr(tbl[i][1]+29*k, 7));
}
switch (i) {
case 0:
case 2:
case 4:
lr(grid);
break;
case 1:
rot(grid);
rot(grid);
rot(grid);
lr(grid);
break;
case 3:
rot(grid);
lr(grid);
break;
case 5:
lr(grid);
ud(grid);
break;
}
d[k][i] = parse(grid);
}
}
int w[2] = {0, 0};
for (int i = 0; i < 6; i++) {
for (int j = 0; j < 6; j++) {
if (d[0][i] > d[1][j]) {
++w[0];
} else if (d[0][i] < d[1][j]) {
++w[1];
}
}
}
cout << (w[0] < w[1] ? "LOW" : "HIGH") << endl;
}
return 0;
} | a.cc:5:24: error: 'string' was not declared in this scope
5 | int parse(const vector<string>& subgrid)
| ^~~~~~
a.cc:3:1: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
2 | #include <algorithm>
+++ |+#include <string>
3 | using namespace std;
a.cc:5:30: error: template argument 1 is invalid
5 | int parse(const vector<string>& subgrid)
| ^
a.cc:5:30: error: template argument 2 is invalid
a.cc: In function 'int parse(const int&)':
a.cc:8:17: error: invalid types 'const int[int]' for array subscript
8 | s |= ((subgrid[1][3] == '-') << 6);
| ^
a.cc:9:17: error: invalid types 'const int[int]' for array subscript
9 | s |= ((subgrid[2][2] == '|') << 5);
| ^
a.cc:10:17: error: invalid types 'const int[int]' for array subscript
10 | s |= ((subgrid[2][4] == '|') << 4);
| ^
a.cc:11:17: error: invalid types 'const int[int]' for array subscript
11 | s |= ((subgrid[3][3] == '-') << 3);
| ^
a.cc:12:17: error: invalid types 'const int[int]' for array subscript
12 | s |= ((subgrid[4][2] == '|') << 2);
| ^
a.cc:13:17: error: invalid types 'const int[int]' for array subscript
13 | s |= ((subgrid[4][4] == '|') << 1);
| ^
a.cc:14:17: error: invalid types 'const int[int]' for array subscript
14 | s |= ((subgrid[5][3] == '-') << 0);
| ^
a.cc: At global scope:
a.cc:29:16: error: 'string' was not declared in this scope
29 | void lr(vector<string>& subgrid)
| ^~~~~~
a.cc:29:16: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:29:22: error: template argument 1 is invalid
29 | void lr(vector<string>& subgrid)
| ^
a.cc:29:22: error: template argument 2 is invalid
a.cc: In function 'void lr(int&)':
a.cc:31:15: error: 'string' was not declared in this scope
31 | for (vector<string>::iterator it = subgrid.begin(); it != subgrid.end(); ++it) {
| ^~~~~~
a.cc:31:15: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:31:21: error: template argument 1 is invalid
31 | for (vector<string>::iterator it = subgrid.begin(); it != subgrid.end(); ++it) {
| ^
a.cc:31:21: error: template argument 2 is invalid
a.cc:31:32: error: expected ';' before 'it'
31 | for (vector<string>::iterator it = subgrid.begin(); it != subgrid.end(); ++it) {
| ^~~
| ;
a.cc:31:33: error: 'it' was not declared in this scope; did you mean 'int'?
31 | for (vector<string>::iterator it = subgrid.begin(); it != subgrid.end(); ++it) {
| ^~
| int
a.cc:31:46: error: request for member 'begin' in 'subgrid', which is of non-class type 'int'
31 | for (vector<string>::iterator it = subgrid.begin(); it != subgrid.end(); ++it) {
| ^~~~~
a.cc:31:69: error: request for member 'end' in 'subgrid', which is of non-class type 'int'
31 | for (vector<string>::iterator it = subgrid.begin(); it != subgrid.end(); ++it) {
| ^~~
a.cc:31:74: error: expected ')' before ';' token
31 | for (vector<string>::iterator it = subgrid.begin(); it != subgrid.end(); ++it) {
| ~ ^
| )
a.cc:31:78: error: 'it' was not declared in this scope; did you mean 'int'?
31 | for (vector<string>::iterator it = subgrid.begin(); it != subgrid.end(); ++it) {
| ^~
| int
a.cc: At global scope:
a.cc:36:16: error: 'string' was not declared in this scope
36 | void ud(vector<string>& subgrid)
| ^~~~~~
a.cc:36:16: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:36:22: error: template argument 1 is invalid
36 | void ud(vector<string>& subgrid)
| ^
a.cc:36:22: error: template argument 2 is invalid
a.cc: In function 'void ud(int&)':
a.cc:38:19: error: request for member 'begin' in 'subgrid', which is of non-class type 'int'
38 | reverse(subgrid.begin(), subgrid.end());
| ^~~~~
a.cc:38:36: error: request for member 'end' in 'subgrid', which is of non-class type 'int'
38 | reverse(subgrid.begin(), subgrid.end());
| ^~~
a.cc: At global scope:
a.cc:41:17: error: 'string' was not declared in this scope
41 | void rot(vector<string>& subgrid)
| ^~~~~~
a.cc:41:17: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:41:23: error: template argument 1 is invalid
41 | void rot(vector<string>& subgrid)
| ^
a.cc:41:23: error: template argument 2 is invalid
a.cc: In function 'void rot(int&)':
a.cc:43:16: error: 'string' was not declared in this scope
43 | const vector<string> src(subgrid);
| ^~~~~~
a.cc:43:16: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:43:22: error: template argument 1 is invalid
43 | const vector<string> src(subgrid);
| ^
a.cc:43:22: error: template argument 2 is invalid
a.cc:46:14: error: invalid types 'const int[int]' for array subscript
46 | if (src[i][j] == '|') {
| ^
a.cc:47:16: error: invalid types 'int[int]' for array subscript
47 | subgrid[6-j][i] = '-';
| ^
a.cc:48:21: error: invalid types 'const int[int]' for array subscript
48 | } else if (src[i][j] == '-') {
| ^
a.cc:49:16: error: invalid types 'int[int]' for array subscript
49 | subgrid[6-j][i] = '|';
| ^
a.cc:51:16: error: invalid types 'int[int]' for array subscript
51 | subgrid[6-j][i] = src[i][j];
| ^
a.cc:51:30: error: invalid types 'const int[int]' for array subscript
51 | subgrid[6-j][i] = src[i][j];
| ^
a.cc: In function 'int main()':
a.cc:59:3: error: 'string' was not declared in this scope
59 | string line;
| ^~~~~~
a.cc:59:3: note: 'std::string' is defined in header '<string>'; this is probably fixable by adding '#include <string>'
a.cc:60:10: error: 'cin' was not declared in this scope
60 | while (cin >> line && line != "0") {
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include <algorithm>
+++ |+#include <iostream>
3 | using namespace std;
a.cc:60:17: error: 'line' was not declared in this scope
60 | while (cin >> line && line != "0") {
| ^~~~
a.cc:61:18: error: template argument 2 is invalid
61 | vector<string> lines(1, line);
| ^
a.cc:61:33: error: expression list treated as compound expression in initializer [-fpermissive]
61 | vector<string> lines(1, line);
| ^
a.cc:64:13: error: request for member 'push_back' in 'lines', which is of non-class type 'int'
64 | lines.push_back(line);
| ^~~~~~~~~
a.cc:70:22: error: template argument 2 is invalid
70 | vector<string> grid;
| ^
a.cc:72:16: error: request for member 'push_back' in 'grid', which is of non-class type 'int'
72 | grid.push_back(lines[tbl[i][0]+j].substr(tbl[i][1]+29*k, 7));
| ^~~~~~~~~
a.cc:72:31: error: invalid types 'int[int]' for array subscript
72 | grid.push_back(lines[tbl[i][0]+j].substr(tbl[i][1]+29*k, 7));
| ^
a.cc:108:5: error: 'cout' was not declared in this scope
108 | cout << (w[0] < w[1] ? "LOW" : "HIGH") << endl;
| ^~~~
a.cc:108:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:108:47: error: 'endl' was not declared in this scope
108 | cout << (w[0] < w[1] ? "LOW" : "HIGH") << endl;
| ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
2 | #include <algorithm>
+++ |+#include <ostream>
3 | using namespace std;
|
s939860665 | p00661 | C++ | #include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
using namespace std;
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))
typedef complex<double> P;
typedef long long ll;
const int MAX_M=100000;
int a[MAX_M];
ll gcd(ll a,ll b){
if(b==0)return a;
return gcd(b,a%b);
}
pair<ll,ll> InclusionExclusion(ll n,ll m){
// a1,a2,..̤¿AÈÆàPÂÅèØêéàÌÌa
ll sum=0;
// ÈÆàPÂÅèØêéàÌÌÂ
ll res=0;
for(int i=1;i<(1<<m);i++){
ll num=0;
for(ll j = i;j!=0;j>>=1)
num+=j&1;
ll lcm=1;
for(int j = 0; j <m; j++){
if((i>>j)&1){
lcm=lcm/gcd(lcm,a[j])*a[j];
if(lcm>n)
break;
}
}
if(num%2==0){
int t=n/lcm;
sum-=lcm*t*(t+1)/2;
res-=n/lcm;
}
else{
res+=n/lcm;
ll t=n/lcm;
sum+=lcm*t*(t+1)/2;
}
}
sum=n*(n+1)/2-sum;
res=n-res;
return make_pair(res,sum);
}
void solve(){
ll n,m;
while(cin>>n>>m&&!(n==0&&m==0)){
for(int i = 0; i < m; i++)
cin>>a[i];
pair<ll,ll> p=InclusionExclusion(n,m);
if(p.first==0){
p.second=0;p.first=1;
}
printf("%.7f\n",(double)p.second/p.first);
}
} | /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
|
s422385355 | p00661 | C++ | #include <iostream>
#include <vector>
#include <cstdio>
using namespace std;
int main()
{
long long int n, m;
while (cin >> n >> m) {
if ((n|m) == 0)
break;
vector<long long int> p(m);
for (int i = 0; i < m; ++i)
cin >> p[i];
long long int sum = (n+1) * n / 2, cnt = n;
for (int i = 1; i < (1 << m); ++i) {
long long int lcm = 1LL;
for (int j = 0; j < m; ++j) {
if (i & (1 << j))
lcm = lcm / __gcd(lcm, p[j]) * p[j];
}
if (__builtin_popcount(i) & 1) {
sum -= lcm * ((n/lcm+1) * n/lcm / 2);
cnt -= n / lcm;
} else {
sum += lcm * ((n/lcm+1) * n/lcm / 2);
cnt += n / lcm;
}
}
if (cnt == 0)
printf("%.10f\n", 0.0);
else
printf("%.10f\n", sum / (cnt * 1.0));
}
return 0;
} | a.cc: In function 'int main()':
a.cc:22:23: error: '__gcd' was not declared in this scope
22 | lcm = lcm / __gcd(lcm, p[j]) * p[j];
| ^~~~~
|
s874755757 | p00662 | Java | public class Main {
public static void main(String[] args) {
final Scanner sc = new Scanner(System.in);
while(true){
final int math = sc.nextInt();
final int greedy = sc.nextInt();
final int geometry = sc.nextInt();
final int dp = sc.nextInt();
final int graph = sc.nextInt();
final int other = sc.nextInt();
if(math == 0 && greedy == 0 && geometry == 0 && dp == 0 && graph == 0 && other == 0){
break;
}
System.out.println(improved(math, greedy, geometry, dp, graph, other));
}
}
public static int improved(int math, int greedy, int geometry, int dp, int graph, int other){
int sum = math / 3 + greedy / 3 + geometry / 3 + dp / 3 + graph / 3 + other / 3;
return sum + slow_bfs(math % 3, greedy % 3, geometry % 3, dp % 3, graph % 3, other % 3);
}
public static class BFS {
int math, greedy, geometry, dp, graph, other;
int contest;
public BFS(int math, int greedy, int geometry, int dp, int graph, int other, int contest) {
super();
this.math = math;
this.greedy = greedy;
this.geometry = geometry;
this.dp = dp;
this.graph = graph;
this.other = other;
this.contest = contest;
}
}
public static int slow_bfs(int math, int greedy, int geometry, int dp, int graph, int other){
LinkedList<BFS> queue = new LinkedList<BFS>();
queue.add(new BFS(math, greedy, geometry, dp, graph, other, 0));
int max = 0;
while(!queue.isEmpty()){
BFS bfs = queue.poll();
if(bfs.math + bfs.dp >= 3){
if(bfs.math >= 3){
queue.add(new BFS(bfs.math - 3, bfs.greedy, bfs.geometry, bfs.dp, bfs.graph, bfs.other, bfs.contest + 1));
}
if(bfs.math >= 2 && bfs.dp >= 1){
queue.add(new BFS(bfs.math - 2, bfs.greedy, bfs.geometry, bfs.dp - 1, bfs.graph, bfs.other, bfs.contest + 1));
}
if(bfs.math >= 1 && bfs.dp >= 2){
queue.add(new BFS(bfs.math - 1, bfs.greedy, bfs.geometry, bfs.dp - 2, bfs.graph, bfs.other, bfs.contest + 1));
}
if(bfs.dp >= 3){
queue.add(new BFS(bfs.math, bfs.greedy, bfs.geometry, bfs.dp - 3, bfs.graph, bfs.other, bfs.contest + 1));
}
}
if(bfs.greedy + bfs.graph >= 3){
if(bfs.greedy >= 3){
queue.add(new BFS(bfs.math, bfs.greedy - 3, bfs.geometry, bfs.dp, bfs.graph, bfs.other, bfs.contest + 1));
}
if(bfs.greedy >= 2 && bfs.graph >= 1){
queue.add(new BFS(bfs.math, bfs.greedy - 2, bfs.geometry, bfs.dp, bfs.graph - 1, bfs.other, bfs.contest + 1));
}
if(bfs.greedy >= 1 && bfs.graph >= 2){
queue.add(new BFS(bfs.math, bfs.greedy - 1, bfs.geometry, bfs.dp, bfs.graph - 2, bfs.other, bfs.contest + 1));
}
if(bfs.graph >= 3){
queue.add(new BFS(bfs.math, bfs.greedy, bfs.geometry, bfs.dp, bfs.graph - 3, bfs.other, bfs.contest + 1));
}
}
if(bfs.geometry + bfs.other >= 3){
if(bfs.geometry >= 3){
queue.add(new BFS(bfs.math, bfs.greedy, bfs.geometry - 3, bfs.dp, bfs.graph, bfs.other, bfs.contest + 1));
}
if(bfs.geometry >= 2 && bfs.other >= 1){
queue.add(new BFS(bfs.math, bfs.greedy, bfs.geometry - 2, bfs.dp, bfs.graph, bfs.other - 1, bfs.contest + 1));
}
if(bfs.geometry >= 1 && bfs.other >= 2){
queue.add(new BFS(bfs.math, bfs.greedy, bfs.geometry - 1, bfs.dp, bfs.graph, bfs.other - 2, bfs.contest + 1));
}
if(bfs.other >= 3){
queue.add(new BFS(bfs.math, bfs.greedy, bfs.geometry, bfs.dp, bfs.graph, bfs.other - 3, bfs.contest + 1));
}
}
for(int first = 0; first <= 1; first++){
if(first == 0 && bfs.math < 1 || first == 1 && bfs.dp < 1){
continue;
}
for(int second = 0; second <= 1; second++){
if(second == 0 && bfs.greedy < 1 || second == 1 && bfs.graph < 1){
continue;
}
for(int third = 0; third <= 1; third++){
if(third == 0 && bfs.geometry < 1 || third == 1 && bfs.other < 1){
continue;
}
queue.add(new BFS(
bfs.math - (first == 0 ? 1 : 0),
bfs.greedy - (second == 0 ? 1 : 0),
bfs.geometry - (third == 0 ? 1 : 0),
bfs.dp - (first == 1 ? 1 : 0),
bfs.graph - (second == 1 ? 1 : 0),
bfs.other - (third == 1 ? 1 : 0),
bfs.contest + 1));
}
}
}
max = Math.max(max, bfs.contest);
}
return max;
}
} | Main.java:6: error: cannot find symbol
final Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:6: error: cannot find symbol
final Scanner sc = new Scanner(System.in);
^
symbol: class Scanner
location: class Main
Main.java:47: error: cannot find symbol
LinkedList<BFS> queue = new LinkedList<BFS>();
^
symbol: class LinkedList
location: class Main
Main.java:47: error: cannot find symbol
LinkedList<BFS> queue = new LinkedList<BFS>();
^
symbol: class LinkedList
location: class Main
4 errors
|
s228957745 | p00662 | C | /*
AOJ 1077
Title:The Great Summer Contest
@kankichi573
*/
#include <stdio.h>
#define max(x,y) (((x)>(y))?(x):(y))
#define min(x,y) (((x)<(y))?(x):(y))
/*
Math
Greedy
Geometry
DP
Graph
Other
*/
int n[6];
int solve(int x1,int x2,int x3)
{
//printf("X123=%d %d %d\n",x1,x2,x3);
int r1,r2,r3,r4,r;
r1=r2=r3=r4=0;
//if(!(x1>0 && x2>0 && x3>0) && x1<3 && x2<3 && x3<3)
// return(0);
if(x1>6 && x2>6 && x3>6)
{
r=min(min(x1,x2),x3)-6;
r4=r+solve(x1-r,x2-r,x3-r);
return(r4);
}
if(x1==0)
return(x2/3 + x3/3);
if(x2==0)
return(x1/3 + x3/3);
if(x2==0)
return(x1/3 + x2/3);
if(x1>=3)
r1=1+solve(x1-3,x2,x3);
if(x2>=3)
r2=1+solve(x1,x2-3,x3);
if(x3>=3)
r2=1+solve(x1,x2,x3-3);
if(x1>0 && x2>0 && x3>0)
r4=1+solve(x1-1,x2-1,x3-1);
return(max(max(r1,r2),max(r3,r4)));
}
main()
{
int ret;
while(scanf("%d %d %d %d %d %d",&n[0],&n[1],&n[2],&n[3],&n[4],&n[5]) &&
(n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]))
{
ret=solve(n[0]+n[3],n[1]+n[4],n[2]+n[5]);
printf("%d\n",ret);
}
return(0);
}
/*
AOJ 1077
Title:The Great Summer Contest
@kankichi573
*/
#include <stdio.h>
#define max(x,y) (((x)>(y))?(x):(y))
#define min(x,y) (((x)<(y))?(x):(y))
/*
Math
Greedy
Geometry
DP
Graph
Other
*/
int n[6];
int solve(int x1,int x2,int x3)
{
//printf("X123=%d %d %d\n",x1,x2,x3);
int r1,r2,r3,r4,r;
r1=r2=r3=r4=0;
//if(!(x1>0 && x2>0 && x3>0) && x1<3 && x2<3 && x3<3)
// return(0);
if(x1>6 && x2>6 && x3>6)
{
r=min(min(x1,x2),x3)-6;
r4=r+solve(x1-r,x2-r,x3-r);
return(r4);
}
if(x1==0)
return(x2/3 + x3/3);
if(x2==0)
return(x1/3 + x3/3);
if(x2==0)
return(x1/3 + x2/3);
if(x1>=3)
r1=1+solve(x1-3,x2,x3);
if(x2>=3)
r2=1+solve(x1,x2-3,x3);
if(x3>=3)
r2=1+solve(x1,x2,x3-3);
if(x1>0 && x2>0 && x3>0)
r4=1+solve(x1-1,x2-1,x3-1);
return(max(max(r1,r2),max(r3,r4)));
}
main()
{
int ret;
while(scanf("%d %d %d %d %d %d",&n[0],&n[1],&n[2],&n[3],&n[4],&n[5]) &&
(n[0]||n[1]||n[2]||n[3]||n[4]||n[5]||n[6]))
{
ret=solve(n[0]+n[3],n[1]+n[4],n[2]+n[5]);
printf("%d\n",ret);
}
return(0);
} | main.c:52:1: error: return type defaults to 'int' [-Wimplicit-int]
52 | main()
| ^~~~
main.c:84:5: error: redefinition of 'solve'
84 | int solve(int x1,int x2,int x3)
| ^~~~~
main.c:21:5: note: previous definition of 'solve' with type 'int(int, int, int)'
21 | int solve(int x1,int x2,int x3)
| ^~~~~
main.c:115:1: error: return type defaults to 'int' [-Wimplicit-int]
115 | main()
| ^~~~
main.c:115:1: error: redefinition of 'main'
main.c:52:1: note: previous definition of 'main' with type 'int()'
52 | main()
| ^~~~
|
s888564369 | p00662 | C++ | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define loop(i,a,b) for(int i=(a);i<ull(b);++i)
#define rep(i,n) loop(i,0,n)
const double eps = 1e-10;
const double pi = acos(-1.0);
const double inf = (int)1e8;
int main(){
ll math, greedy, geometry, dp, graph, other;
while(cin >> math >> greedy >> geometry >> dp >> graph >> other){
if(math+greedy+geometry+dp+graph+other == 0 ) break;
ll bmath = math, bgreedy = greedy, bgeometry = geometry, bdp = dp, bgraph = graph, bother = other;
ll count_f = 0;
count_f += min(math+dp, min(greedy+graph, geometry+other));
math -= count_f; greedy -= count_f; geometry -= count_f;
count_f += (math+dp)/3+(greedy+graph)/3+(geometry+other)/3;
ll math = bmath, greedy = bgreedy, geometry = bgeometry, dp = bdp, graph = bgraph, other = bother;
ll count_s = 0, a;
a = (math+dp)/3; math-=a*3; count_s+=a;
a = (greedy+graph)/3; greedy-=a*3; count_s+=a;
a = (geometry+other)/3;geometry-=a*3;count_s+=a;
count_s += min(math+dp, min(greedy+graph, geometry+other));
cout << max(count_f, count_s) << endl;
}
} | a.cc:1:2: error: stray '#' in program
1 | #include <iostream>
| ^
a.cc:1:10: error: stray '#' in program
1 | #include <iostream>
| ^
a.cc:1:17: error: stray '#' in program
1 | #include <iostream>
| ^
a.cc:1:3: error: expected unqualified-id before numeric constant
1 | #include <iostream>
| ^~~~~
a.cc:1:11: error: expected unqualified-id before numeric constant
1 | #include <iostream>
| ^~~~~
a.cc:1:18: error: 'include' does not name a type
1 | #include <iostream>
| ^~~~~~~
In file included from /usr/include/c++/14/bits/stl_algobase.h:62,
from /usr/include/c++/14/vector:62,
from a.cc:2:
/usr/include/c++/14/ext/type_traits.h:164:35: error: 'constexpr const bool __gnu_cxx::__is_null_pointer' redeclared as different kind of entity
164 | __is_null_pointer(std::nullptr_t)
| ^
/usr/include/c++/14/ext/type_traits.h:159:5: note: previous declaration 'template<class _Type> constexpr bool __gnu_cxx::__is_null_pointer(_Type)'
159 | __is_null_pointer(_Type)
| ^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ext/type_traits.h:164:26: error: 'nullptr_t' is not a member of 'std'
164 | __is_null_pointer(std::nullptr_t)
| ^~~~~~~~~
In file included from /usr/include/c++/14/bits/stl_pair.h:60,
from /usr/include/c++/14/bits/stl_algobase.h:64:
/usr/include/c++/14/type_traits:295:27: error: 'size_t' has not been declared
295 | template <typename _Tp, size_t = sizeof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:666:33: error: 'nullptr_t' is not a member of 'std'
666 | struct is_null_pointer<std::nullptr_t>
| ^~~~~~~~~
/usr/include/c++/14/type_traits:666:42: error: template argument 1 is invalid
666 | struct is_null_pointer<std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:670:48: error: template argument 1 is invalid
670 | struct is_null_pointer<const std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:674:51: error: template argument 1 is invalid
674 | struct is_null_pointer<volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:678:57: error: template argument 1 is invalid
678 | struct is_null_pointer<const volatile std::nullptr_t>
| ^
/usr/include/c++/14/type_traits:984:26: error: 'size_t' has not been declared
984 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:985:40: error: '_Size' was not declared in this scope
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:985:46: error: template argument 1 is invalid
985 | struct __is_array_known_bounds<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1429:37: error: 'size_t' is not a member of 'std'
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^~~~~~
/usr/include/c++/14/type_traits:1429:57: error: template argument 1 is invalid
1429 | : public integral_constant<std::size_t, alignof(_Tp)>
| ^
/usr/include/c++/14/type_traits:1429:57: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1438:37: error: 'size_t' is not a member of 'std'
1438 | : public integral_constant<std::size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1438:46: error: template argument 1 is invalid
1438 | : public integral_constant<std::size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1438:46: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1440:26: error: 'std::size_t' has not been declared
1440 | template<typename _Tp, std::size_t _Size>
| ^~~
/usr/include/c++/14/type_traits:1441:21: error: '_Size' was not declared in this scope
1441 | struct rank<_Tp[_Size]>
| ^~~~~
/usr/include/c++/14/type_traits:1441:27: error: template argument 1 is invalid
1441 | struct rank<_Tp[_Size]>
| ^
/usr/include/c++/14/type_traits:1442:37: error: 'size_t' is not a member of 'std'
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1442:65: error: template argument 1 is invalid
1442 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1442:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1446:37: error: 'size_t' is not a member of 'std'
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1446:65: error: template argument 1 is invalid
1446 | : public integral_constant<std::size_t, 1 + rank<_Tp>::value> { };
| ^
/usr/include/c++/14/type_traits:1446:65: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1451:32: error: 'size_t' was not declared in this scope
1451 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:64:1: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
63 | #include <bits/version.h>
+++ |+#include <cstddef>
64 |
/usr/include/c++/14/type_traits:1451:41: error: template argument 1 is invalid
1451 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1451:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1453:26: error: 'size_t' has not been declared
1453 | template<typename _Tp, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1454:23: error: '_Size' was not declared in this scope
1454 | struct extent<_Tp[_Size], 0>
| ^~~~~
/usr/include/c++/14/type_traits:1454:32: error: template argument 1 is invalid
1454 | struct extent<_Tp[_Size], 0>
| ^
/usr/include/c++/14/type_traits:1455:32: error: 'size_t' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1455:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1455:40: error: '_Size' was not declared in this scope
1455 | : public integral_constant<size_t, _Size> { };
| ^~~~~
/usr/include/c++/14/type_traits:1455:45: error: template argument 1 is invalid
1455 | : public integral_constant<size_t, _Size> { };
| ^
/usr/include/c++/14/type_traits:1455:45: error: template argument 2 is invalid
/usr/include/c++/14/type_traits:1457:42: error: 'size_t' has not been declared
1457 | template<typename _Tp, unsigned _Uint, size_t _Size>
| ^~~~~~
/usr/include/c++/14/type_traits:1458:23: error: '_Size' was not declared in this scope
1458 | struct extent<_Tp[_Size], _Uint>
| ^~~~~
/usr/include/c++/14/type_traits:1458:36: error: template argument 1 is invalid
1458 | struct extent<_Tp[_Size], _Uint>
| ^
/usr/include/c++/14/type_traits:1463:32: error: 'size_t' was not declared in this scope
1463 | : public integral_constant<size_t, 0> { };
| ^~~~~~
/usr/include/c++/14/type_traits:1463:32: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1463:41: error: template argument 1 is invalid
1463 | : public integral_constant<size_t, 0> { };
| ^
/usr/include/c++/14/type_traits:1463:41: note: invalid template non-type parameter
/usr/include/c++/14/type_traits:1857:26: error: 'size_t' does not name a type
1857 | { static constexpr size_t __size = sizeof(_Tp); };
| ^~~~~~
/usr/include/c++/14/type_traits:1857:26: note: 'size_t' is defined in header '<cstddef>'; this is probably fixable by adding '#include <cstddef>'
/usr/include/c++/14/type_traits:1859:14: error: 'size_t' has not been declared
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~~~~
/usr/include/c++/14/type_traits:1859:48: error: '_Sz' was not declared in this scope
1859 | template<size_t _Sz, typename _Tp, bool = (_Sz <= _Tp::__size)>
| ^~~
/usr/include/c++/14/type_traits:1860:14: error: no default argument for '_Tp'
1860 | struct __select;
| ^~~~~~~~
/usr/include/c++/14/type_traits:1862:14: error: 'size_t' has not been declared
1862 | template<size_t _Sz, typename _Uint, typename... _UInts>
| ^~~~~~
/usr/include/c++/14/type_traits:1863:23: error: '_Sz' was not declared in this scope
1863 | struct __select<_Sz, _List<_Uint, _UInts...>, true>
| ^~~
/usr/include/c++/14/type_traits:1863:57: error: template argument 1 is invalid
1863 | struct __select<_Sz, _List<_Uint, _U |
s856979336 | p00662 | C++ | #include<iostream>
using namespace std;
int main(){
int mat,gre,geo,dp,gra,oth;
int suu,aru,jit;
int mosmin;
int cnt=0;
int end=1;
while(cin>> mat>> gre>> geo>> dp>> gra>> oth){
if(mat==0&&gre==0&&geo==0&&dp==0&&gra==0&&oth==0){
break;
}
suu=mat+dp;
aru=gre+gra;
jit=geo+oth;
cnt=min(suu,aru,jit);
suu-=cnt;
aru-=cnt;
jit-=cnt;
cnt+=(suu/3+aru/3+jit/3);
cout<< cnt;
}
} | 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: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:20:12: required from here
20 | cnt=min(suu,aru,jit);
| ~~~^~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
284 | if (__comp(__b, __a))
| ~~~~~~^~~~~~~~~~
|
s279986022 | p00662 | C++ | #include<iostream>
#include <algorithm>
using namespace std;
int main(){
int mat,gre,geo,dp,gra,oth;
int suu,aru,jit;
int mosmin;
while(cin>> mat>> gre>> geo>> dp>> gra>> oth,mat+gre+geo+dp+gra+oth){
suu=mat+dp;
aru=gre+gra;
jit=geo+oth;
cnt=min(suu,aru);
cnt=min(cnt,jit);
suu-=cnt;
aru-=cnt;
jit-=cnt;
cnt+=(suu/3+aru/3+jit/3);
cout<< cnt<< endl;
}
} | a.cc: In function 'int main()':
a.cc:16:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
16 | cnt=min(suu,aru);
| ^~~
| int
|
s634260741 | p00662 | C++ | #include<iostream>
#include <algorithm>
using namespace std;
int main(){
int mat,gre,geo,dp,gra,oth;
int suu,aru,jit;
int mosmin;
while(cin>> mat>> gre>> geo>> dp>> gra>> oth,mat+gre+geo+dp+gra+oth){
suu=mat+dp;
aru=gre+gra;
jit=geo+oth;
cnt=min(suu,aru);
cnt=min(cnt,jit);
suu-=cnt;
aru-=cnt;
jit-=cnt;
cnt+=(suu/3+aru/3+jit/3);
cout<< cnt<< endl;
}
} | a.cc: In function 'int main()':
a.cc:16:5: error: 'cnt' was not declared in this scope; did you mean 'int'?
16 | cnt=min(suu,aru);
| ^~~
| int
|
s211577625 | p00662 | C++ | #include<iostream>
#include <algorithm>
using namespace std;
int main(){
int mat,gre,geo,dp,gra,oth;
int suu,aru,jit;
int mosmin;
int cnt=0;
while(cin>> mat>> gre>> geo>> dp>> gra>> oth,){
if((a|b|c|d|e|f) == 0) break;
suu=mat+dp;
aru=gre+gra;
jit=geo+oth;
cnt=min(suu,aru);
cnt=min(cnt,jit);
suu-=cnt;
aru-=cnt;
jit-=cnt;
cnt+=(suu/3+aru/3+jit/3);
cout<< cnt<< endl;
}
} | a.cc: In function 'int main()':
a.cc:11:48: error: expected primary-expression before ')' token
11 | while(cin>> mat>> gre>> geo>> dp>> gra>> oth,){
| ^
a.cc:12:9: error: 'a' was not declared in this scope
12 | if((a|b|c|d|e|f) == 0) break;
| ^
a.cc:12:11: error: 'b' was not declared in this scope
12 | if((a|b|c|d|e|f) == 0) break;
| ^
a.cc:12:13: error: 'c' was not declared in this scope
12 | if((a|b|c|d|e|f) == 0) break;
| ^
a.cc:12:15: error: 'd' was not declared in this scope; did you mean 'dp'?
12 | if((a|b|c|d|e|f) == 0) break;
| ^
| dp
a.cc:12:17: error: 'e' was not declared in this scope
12 | if((a|b|c|d|e|f) == 0) break;
| ^
a.cc:12:19: error: 'f' was not declared in this scope
12 | if((a|b|c|d|e|f) == 0) break;
| ^
|
s555973169 | p00662 | C++ | #include<iostream>
#include <algorithm>
using namespace std;
int main(){
int mat,gre,geo,dp,gra,oth;
int suu,aru,jit;
int mosmin;
int cnt=0;
while(cin>> mat>> gre>> geo>> dp>> gra>> oth){
if((a|b|c|d|e|f) == 0) break;
suu=mat+dp;
aru=gre+gra;
jit=geo+oth;
cnt=min(suu,aru);
cnt=min(cnt,jit);
suu-=cnt;
aru-=cnt;
jit-=cnt;
cnt+=(suu/3+aru/3+jit/3);
cout<< cnt<< endl;
}
} | a.cc: In function 'int main()':
a.cc:12:9: error: 'a' was not declared in this scope
12 | if((a|b|c|d|e|f) == 0) break;
| ^
a.cc:12:11: error: 'b' was not declared in this scope
12 | if((a|b|c|d|e|f) == 0) break;
| ^
a.cc:12:13: error: 'c' was not declared in this scope
12 | if((a|b|c|d|e|f) == 0) break;
| ^
a.cc:12:15: error: 'd' was not declared in this scope; did you mean 'dp'?
12 | if((a|b|c|d|e|f) == 0) break;
| ^
| dp
a.cc:12:17: error: 'e' was not declared in this scope
12 | if((a|b|c|d|e|f) == 0) break;
| ^
a.cc:12:19: error: 'f' was not declared in this scope
12 | if((a|b|c|d|e|f) == 0) break;
| ^
|
s948286995 | p00662 | C++ | int main(){
return 1
} | a.cc: In function 'int main()':
a.cc:2:10: error: expected ';' before '}' token
2 | return 1
| ^
| ;
3 | }
| ~
|
s266847723 | p00662 | C++ | int main(){
cout << 1 << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:2:9: error: 'cout' was not declared in this scope
2 | cout << 1 << endl;
| ^~~~
a.cc:2:22: error: 'endl' was not declared in this scope
2 | cout << 1 << endl;
| ^~~~
|
s988347285 | p00662 | C++ | #include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f,s1,s2,s3,s,p;
int main() {
while(1){
s=0;
cin>>a>>b>>c>>d>>e>>f;
s1=a+d;
s2=b+e;
s3=c+f;
if(s1+s2+s3==0){break;}
p=min(s1,min(s2,s3))
for(i=max(0,p-9);i<=p;i++){
s=max(s,i+(s1-i)/3+(s2-i)/3+(s3-i)/3);
}
cout<<s<<endl;
}
} | a.cc: In function 'int main()':
a.cc:12:37: error: expected ';' before 'for'
12 | p=min(s1,min(s2,s3))
| ^
| ;
13 | for(i=max(0,p-9);i<=p;i++){
| ~~~
a.cc:13:34: error: 'i' was not declared in this scope
13 | for(i=max(0,p-9);i<=p;i++){
| ^
|
s955122994 | p00662 | C++ | #include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,f,s1,s2,s3,s,p;
int main() {
while(1){
s=0;
cin>>a>>b>>c>>d>>e>>f;
s1=a+d;
s2=b+e;
s3=c+f;
if(s1+s2+s3==0){break;}
p=min(s1,min(s2,s3));
for(i=max(0,p-9);i<=p;i++){
s=max(s,i+(s1-i)/3+(s2-i)/3+(s3-i)/3);
}
cout<<s<<endl;
}
} | a.cc: In function 'int main()':
a.cc:13:21: error: 'i' was not declared in this scope
13 | for(i=max(0,p-9);i<=p;i++){
| ^
|
s619844113 | p00662 | C++ | #include <iostream>
using namespace std;
template<typename First, typename Second, typename... Rest>
int min(First first, Second second, Rest... rest)
{
if (first < second) return min(first, rest...);
else return min(second, rest...);
}
int min(int first, int second)
{
if (first < second) return first;
else return second;
}
int main()
{
while (true)
{
int problem[6];
int n[3] = {0};
int ans = 0;
bool DoBreak = true;
for (int i = 0; i < 6; ++i)
{
cin >> problem[i];
if (problem[i] != 0) DoBreak = false;
}
if (DoBreak) break;
for (int i = 0; i < 3; ++i)
{
n[i] = problem[i] + problem[3 + i]; //2??????1?????¢????????¨??????
}
//??????????????? 1, 2, 3
for (int i = 0; i < 3; ++i)
{
ans += n[i] / 3;
n[i] = n[i] % 3;
}
//??????????????? 4
{
ans += min(n[0], n[1], n[2]);
}
cout << ans << endl;
}
return 0;
} | 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: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:47:14: required from here
47 | ans += min(n[0], n[1], n[2]);
| ~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
284 | if (__comp(__b, __a))
| ~~~~~~^~~~~~~~~~
|
s194012798 | p00662 | C++ | #include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c,d,e,f,ad,be,cf,ans,sum;
while(1){
cin>>a>>b>>c>>d>>e>>f;
if(a+b+c+d+e+f==0)break;
ans=0;
ad=a+d;
be=b+e;
cf=c+f;
ans+=min(min(ad,be),cf);
ad-=ans;
be-=ans;
cf-=ans;
ans+=ad/3;
ans+=be/3;
ans+=cf/3;
sum=0;
ad=a+d;
be=b+e;
cf=c+f;
sum+=ad/3;
ad=ad%3;
sum+=be/3;
be=be%3;
sum+=cf/3;
cf=cf%3;
sum+=min(min(ad,be),cf);
cout<<max(ans,max)<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:35:14: error: no matching function for call to 'max(int&, <unresolved overloaded function type>)'
35 | cout<<max(ans,max)<<endl;
| ~~~^~~~~~~~~
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: 'constexpr const _Tp& std::max(const _Tp&, const _Tp&) [with _Tp = int]'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:36: note: no known conversion for argument 2 from '<unresolved overloaded function type>' to 'const int&'
257 | max(const _Tp& __a, const _Tp& __b)
| ~~~~~~~~~~~^~~
/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:35:14: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
35 | cout<<max(ans,max)<<endl;
| ~~~^~~~~~~~~
|
s352505111 | p00662 | C++ | loop do
a = gets.split.map(&:to_i)
break if a.all? {|x| x == 0}
x, y, z = a[0] + a[3], a[1] + a[4], a[2] + a[5]
n = 0
if x > 0
n += x / 3
x %= 3
if x == 0
n -= 1
x = 3
end
end
if y > 0
n += y / 3
y %= 3
if y == 0
n -= 1
y = 3
end
end
if z > 0
n += z / 3
z %= 3
if z == 0
n -= 1
z = 3
end
end
r = [x, y, z].sort
if r[0] == 3
n += 3
elsif r[0] == 2
n += 2
elsif r[0] == 1 && r[1] <= 2
n += 1
else
n += 1 if r[1] == 3
n += 1 if r[2] == 3
end
puts n
end
| a.cc:1:1: error: 'loop' does not name a type
1 | loop do
| ^~~~
a.cc:4:5: error: 'x' does not name a type
4 | x, y, z = a[0] + a[3], a[1] + a[4], a[2] + a[5]
| ^
|
s258428652 | p00662 | C++ | //02
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
for(int a,b,c,d,e,f;cin>>a>>b>>c>>d>>e>>f,a|b|c|d|e|f;){
int x=a+d;
int y=b+e;
int z=c+f;
int xt=(x-1)/3;
int yt=(y-1)/3;
int zt=(z-1)/3;
x-=xt*3;
y-=yt*3;
z-=zt*3;
int ar[]={x,y,z};
sort(ar,ar+3);
int ex=max(ar[0],count(ar,ar+3,3));
cout<<xt+yt+zt+ex<<endl;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:20:15: error: no matching function for call to 'max(int&, std::iterator_traits<int*>::difference_type)'
20 | int ex=max(ar[0],count(ar,ar+3,3));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
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: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:20:15: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'std::iterator_traits<int*>::difference_type' {aka 'long int'})
20 | int ex=max(ar[0],count(ar,ar+3,3));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
/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,
from a.cc:3:
/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:20:15: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
20 | int ex=max(ar[0],count(ar,ar+3,3));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~
|
s076695435 | p00662 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
while(true){
vector<int> vi(3);
for(int i=0; i<6; ++i){
int tmp;
cin >> tmp;
vi[i%3]+=tmp;
}
bool flag=true;
for(int i=0; i<3; ++i){
if(vi[i]!=0) flag=false;
}
if(flag) break;
int ans=0;
for(int i=0; i<3; ++i){
vector<int> hoge=vi;
int sum=0;
{
int tmp=min(hoge[0],min(i,min(hoge[1],hoge[2])));a
for(int j=0; j<3; ++j) hoge[j]-=tmp;
sum+=tmp;
}
for(int j=0; j<3; ++j){
int tmp=hoge[j]/3;
hoge[j]-=tmp*3;
sum+=tmp;
}
ans=max(ans,sum);
}
cout << ans << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:24:82: error: 'a' was not declared in this scope
24 | int tmp=min(hoge[0],min(i,min(hoge[1],hoge[2])));a
| ^
a.cc:25:46: error: 'j' was not declared in this scope
25 | for(int j=0; j<3; ++j) hoge[j]-=tmp;
| ^
|
s399951128 | p00663 | C++ | #include<bits/stdc++.h>
// Shrotening
#define fst first
#define snd second
#define pb push_back
// Loop
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define RFOR(i,a,b) for(long i=(a);i>=(b);--i)
#define REP(i,a) for(long i=0;i<(a);++i)
#define RREP(i,a) for(long i=(a);i>=0;--i)
#define EACH(i,a) for(auto (i)=(a).begin(),_END=(a).end();i!=_END;++i)
#define REACH(i,a) for(auto (i)=(a).rbegin(),_END=(a).rend();i!=_END;++i)
//Algorithm
#define ALL(a) (a).begin(), a.end()
#define RALL(a) (a).rbegin(), a.rend()
#define EXIST(a,x) ((a).find(x)!=(a).end())
#define SORT(a) std::sort((a).begin(), (a).end())
#define UNIQUE(a) std::sort((a).begin(), a.end()), a.erase(std::unique((a).begin(), a.end()), a.end());
#define SUM(a) std::accumulate((a).begin(), (a).end(), 0);
//Setting
#define OPT std::cin.tie(0);std::ios::sync_with_stdio(false);
//debug message
bool debug = true;
#define MSG(s) if(debug){std::cout << s << std::endl;}
#define DEBUG(x) if(debug){std::cout << "debug(" << #x << "): " << x << std::endl;}
//alias
typedef long long LL;
typedef std::vector<char> VC;
typedef std::vector<int> VI;
typedef std::vector<long> VL;
typedef std::vector<long long> VLL;
typedef std::vector< VC > VC2;
typedef std::vector< VI > VI2;
typedef std::vector< VL > VL2;
typedef std::vector< VLL > VLL2;
typedef std::pair<int,int> PII;
typedef struct ParseState {
int pos;
int len;
std::string str;
State(int p, int l, std::string s) {
pos = p;
len = l;
str = s;
}
bool isEOF() {
return pos >= len;
}
bool isNotEOF() {
return pos < len;
}
char getCh() {
if(pos >= len) return -1;
else {
char c = str[pos];
pos += 1;
return c;
}
}
char seek() {
return pos < len ? str[pos] : -1;
}
char seek(int offset) {
return ((pos + offset) < len) ? str[pos+offset] : -1;
}
std::string lookAhead(int l) {
return ((pos + l) < len) ? str.substr(pos, l) : "";
}
std::string remain() {
return pos < len ? str.substr(pos) : "";
}
} State;
bool Expr(State*);
bool Clas(State*);
char Lite(State*);
/*
<Expr> = '(' <Clause> ')' | '(' <clause> ')|(' <Expression> ')'
<Clause> = <Literal> '&' <Literal> '&' <Literal>
<Literal> = <variable> | '~'<variable>
<Expr> = '(' <Clause> ')' {'|(' <Expression> ')'}*
*/
bool Expr(State* s) {
bool result = false;
while(s->isNotEOF()) {
s->getCh(); // Eat (
bool res = Clas(s);
result |= res;
s->getCh(); // Eat )
if(s->isEOF()) break;
s->getCh(); // Eat |
}
return result;
}
bool Clas(State* s) {
std::set< std::pair<bool, char> > set;
for(int i=0; i<3; ++i) {
bool flag = true;
if(s->seek() == '~') {
flag = false;
s->getCh(); //Eat ~
}
char c = s->getCh();
if(set.count(std::make_pair(!flag, c)) > 0) {
return false;
}
set.insert(std::make_pair(flag, c));
if(i < 2) {
s->getCh();
}
}
return true;
}
int main() {
std::string s;
while( std::cin >> s, !(s.length() == 1 && s[0] == '#') ) {
State state = State(0, s.length(), s);
bool res = Expr(&state);
std::cout << (res ? "Yes" : "No") << std::endl;
}
} | a.cc:53:5: error: ISO C++ forbids declaration of 'State' with no type [-fpermissive]
53 | State(int p, int l, std::string s) {
| ^~~~~
a.cc: In member function 'int ParseState::State(int, int, std::string)':
a.cc:57:5: warning: no return statement in function returning non-void [-Wreturn-type]
57 | }
| ^
a.cc: In function 'int main()':
a.cc:138:45: error: no matching function for call to 'ParseState::ParseState(int, std::__cxx11::basic_string<char>::size_type, std::string&)'
138 | State state = State(0, s.length(), s);
| ^
a.cc:48:16: note: candidate: 'ParseState::ParseState()'
48 | typedef struct ParseState {
| ^~~~~~~~~~
a.cc:48:16: note: candidate expects 0 arguments, 3 provided
a.cc:48:16: note: candidate: 'ParseState::ParseState(const ParseState&)'
a.cc:48:16: note: candidate expects 1 argument, 3 provided
a.cc:48:16: note: candidate: 'ParseState::ParseState(ParseState&&)'
a.cc:48:16: note: candidate expects 1 argument, 3 provided
|
s875851491 | p00663 | C++ | #include <vector>
#include <string>
#include <iostream>
#include <cstdio>
using namespace std;
string x,y;
vector<string> split(string &str, const char *delim){
vector<string> result;
int cutAt;
while( (cutAt = str.find_first_of(delim)) != str.npos ){
if(cutAt > 0){
result.push_back(str.substr(0, cutAt));
}
str = str.substr(cutAt + 1);
}
if(str.length() > 0){
result.push_back(str);
}
return result;
}
void solve(string &exp){
int i=0,j,r;
vector<string> token = split(exp,"|");
for(;i<token.size();i++){
string t=token[i].substr(1,token[i].size()-2);
vector<string> prob = split(t,"&");
for(r=j=0;j<prob.size();j++){
if(prob[j][0]!='~'&&find(prob.begin(),prob.end(),y+prob[j])!=prob.end())r++;
}
if(!r)break;
}
puts(i==token.size()?"no":"yes");
}
int main(){x="#",y="~";for(string str;getline(cin,str),str!=x;solve(str));} | a.cc: In function 'void solve(std::string&)':
a.cc:30:49: error: no matching function for call to 'find(std::vector<std::__cxx11::basic_string<char> >::iterator, std::vector<std::__cxx11::basic_string<char> >::iterator, std::__cxx11::basic_string<char>)'
30 | if(prob[j][0]!='~'&&find(prob.begin(),prob.end(),y+prob[j])!=prob.end())r++;
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:3:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT, std::char_traits<_CharT> > >::__type std::find(istreambuf_iterator<_CharT, char_traits<_CharT> >, istreambuf_iterator<_CharT, char_traits<_CharT> >, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:30:49: note: '__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<char>*, std::vector<std::__cxx11::basic_string<char> > >' is not derived from 'std::istreambuf_iterator<_CharT, std::char_traits<_CharT> >'
30 | if(prob[j][0]!='~'&&find(prob.begin(),prob.end(),y+prob[j])!=prob.end())r++;
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s521668025 | p00663 | C++ | #include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define EACH(t,i,c) for(t::iterator i=(c).begin(); i!=(c).end(); ++i)
const double EPS = 1e-10;
const double PI = acos(-1.0);
struct lit{
char c;
bool not;
lit(char c,bool not):c(c),not(not){}
};
bool clause(string &exp,int &p){
//<clause> ::= <literal>"&"<literal>"&"<literal>
//<literal> ::= <variable> | "~"<variable>
//<variable> ::= [a-z]|[A-z]
vector<lit> literals;
REP(i,3){
bool not=false;
if(exp[p]=='~'){
not=true;
p++;
}
assert(isalpha(exp[p]));
literals.push_back(lit(exp[p],not));
p++;
if(i!=2){
assert(exp[p]=='&');
p++;
}
}
REP(i,3){
FOR(j,i+1,3){
if(literals[i].c==literals[j].c&&literals[i].not!=literals[j].not){
return false;
}
}
}
return true;
}
bool expression(string &exp,int &p){
//<expression> ::= "("<clause>")" | "("<clause>")|("<expression>")"
while(1){
assert(exp[p]=='(');
p++;
if(clause(exp,p)){
return true;
}
assert(exp[p]==')');
p++;
if(p>=exp.size()||exp[p]!='|'){
break;
}
p++;
}
return false;
}
int main(){
string exp;
while(cin>>exp,exp!="#"){
int p=0;
cout<<(expression(exp,p)?"yes":"no")<<endl;
}
} | a.cc:41:14: error: expected unqualified-id before 'not' token
41 | bool not;
| ^~~
a.cc:42:25: error: expected ',' or '...' before 'not' token
42 | lit(char c,bool not):c(c),not(not){}
| ^~~
a.cc: In constructor 'lit::lit(char, bool)':
a.cc:42:35: error: expected identifier before 'not' token
42 | lit(char c,bool not):c(c),not(not){}
| ^~~
a.cc:42:35: error: expected '{' before 'not' token
a.cc: In function 'bool clause(std::string&, int&)':
a.cc:51:22: error: expected unqualified-id before 'not' token
51 | bool not=false;
| ^~~
a.cc:53:28: error: expected primary-expression before '=' token
53 | not=true;
| ^
a.cc:57:39: error: expected primary-expression before '(' token
57 | literals.push_back(lit(exp[p],not));
| ^
a.cc:57:50: error: expected primary-expression before ')' token
57 | literals.push_back(lit(exp[p],not));
| ^
a.cc:66:70: error: expected unqualified-id before 'not' token
66 | if(literals[i].c==literals[j].c&&literals[i].not!=literals[j].not){
| ^~~
a.cc:66:70: error: expected ')' before 'not' token
66 | if(literals[i].c==literals[j].c&&literals[i].not!=literals[j].not){
| ~ ^~~
| )
|
s326953764 | p00664 | C++ | #include <iostream>
using namespace std;
int main()
{
int r,c,q;
int a[10000],b[10000],o[10000];
int nrow,ncol;
long int out;
bool row[50000],col[50000];
while( cin >> r >> c >> q, (r||c||q))
{
for( int i = 0; i < q ; i++)
{
cin>>a[q-i-1]>>b[q-i-1]>>o[q-i-1];
}
memset(row, 0, sizeof(row));
memset(col, 0, sizeof(col));
out = 0;
nrow = 0;
ncol = 0;
for( int i = 0; i < q ; i++)
{
if(a[i] == 0)
{
if(row[b[i]])
continue;
row[b[i]] = 1;
nrow++;
if(o[i] == 1)
out += c-ncol;
}
else
{
if(col[b[i]])
continue;
col[b[i]] = 1;
ncol++;
if(o[i] == 1)
out += r-nrow;
}
}
cout << out << endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:20:17: error: 'memset' was not declared in this scope
20 | memset(row, 0, sizeof(row));
| ^~~~~~
a.cc:2:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include <iostream>
+++ |+#include <cstring>
2 |
|
s884132705 | p00665 | C++ | #include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <list>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <string>
#include <sstream>
#include <cstring>
#include <cstdlib>
using namespace std;
#define ALL(c) c.begin(),c.end()
#define RALL(c) c.rbegin(),c.rend()
#define SORT(x) sort((x).begin(),(x).end())
#define REP(i,x,y) for(int i=(x);i<(y);++i)
#define MP(a,b) make_pair((a),(b))
#define debug(x) #x << "=" << (x)
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x)
#endif
typedef long long int ll;
typedef pair<int,int> pii;
//template<typename T> using vec=std::vector<T>;
const int INF=1<<30;
const long long int INF_=1LL<<58;
const double EPS=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
os << "[";
for (const auto &v : vec) {
os << v << ",";
}
os << "]";
return os;
}
struct Chara{
string name;
ll vote;
bool operator<(const Chara &c)const{
if(vote==c.vote) return name<c.name;
return vote>c.vote;
}
};
ll n,m,k,l;
Chara charas[100010];
vector<Chara> favs,unfavs;
bool Check(int x){
if(x>k||x>m) return false;
if(unfavs.size()<k-x+1) return false;
ll cost=0;
REP(i,0,x){
cost+=max(0,unfavs[k-x].vote-favs[i].vote+(favs[i].name>unfavs[k-x].name));
if(cost>l) return false;
}
return true;
}
void Solve(){
while(true){
cin >> n >> m >> k >> l;
if(n+m+k+l==0) break;
REP(i,0,n) cin >> charas[i].name >> charas[i].vote;
unordered_set<string> fav_names(m);
REP(i,0,m){
string name;
cin >> name;
fav_names.insert(name);
}
sort(charas,charas+n);
REP(i,0,n){
if(fav_names.find(charas[i].name)!=fav_names.end()) favs.push_back(charas[i]);
else unfavs.push_back(charas[i]);
}
int lb=0,ub=m+10;
while(true){
if(ub-lb<=1){
if(Check(ub)) lb=ub;
break;
}
int mid=(lb+ub)/2;
if(Check(mid)) lb=mid;
else ub=mid;
}
cout << lb << endl;
favs.clear();
unfavs.clear();
}
}
int main(){
std::ios::sync_with_stdio(false);
std::cin.tie(0);
Solve();
return 0;
} | a.cc: In function 'bool Check(int)':
a.cc:70:26: error: no matching function for call to 'max(int, ll)'
70 | cost+=max(0,unfavs[k-x].vote-favs[i].vote+(favs[i].name>unfavs[k-x].name));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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: template argument deduction/substitution failed:
a.cc:70:26: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
70 | cost+=max(0,unfavs[k-x].vote-favs[i].vote+(favs[i].name>unfavs[k-x].name));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/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,
from a.cc:2:
/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:70:26: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
70 | cost+=max(0,unfavs[k-x].vote-favs[i].vote+(favs[i].name>unfavs[k-x].name));
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s131369993 | p00665 | C++ | struct S{
char s[11];
int x;
bool operator<(const S &r)const{
if(x!=r.x)return x>r.x;
return strcmp(s,r.s)<0;
}
};
S chara[100000];
int n,m,k,l;
vector<S> like, dislike;
ll calc(int m){
ll need=0;
if(dislike.size()<k-m+1)return 0;
rep(i,m){
//cerr<<"hoge: "<<dislike[k-m].x-like[i].x<<endl;
need+=max(0,dislike[k-m].x-like[i].x+
(strcmp(dislike[k-m].s,like[i].s)<0));
}
//cerr<<"m: "<<m<<" need: "<<need<<endl;
return need;
}
int main(){
while(scanf("%d%d%d%d",&n,&m,&k,&l),n){
set<string> names;
rep(i,n)scanf("%s%d",chara[i].s,&chara[i].x);
rep(i,m){
char in[11]; scanf("%s",in);
names.insert(string(in));
}
like.clear(); dislike.clear();
rep(i,n){
if(names.count(chara[i].s))like.pb(chara[i]);
else dislike.pb(chara[i]);
}
sort(all(like)); sort(all(dislike));
//rep(i,dislike.size())cerr<<dislike[i].s<<" "<<dislike[i].x<<endl;
int lo=0, hi=min(m,k)+1, mid;
while(lo+1<hi){
mid=(lo+hi)/2;
if(calc(mid)<=l)lo=mid; else hi=mid;
}
printf("%d\n",lo);
}
return 0;
} | a.cc: In member function 'bool S::operator<(const S&) const':
a.cc:6:12: error: 'strcmp' was not declared in this scope
6 | return strcmp(s,r.s)<0;
| ^~~~~~
a.cc:1:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
+++ |+#include <cstring>
1 | struct S{
a.cc: At global scope:
a.cc:12:1: error: 'vector' does not name a type
12 | vector<S> like, dislike;
| ^~~~~~
a.cc:13:1: error: 'll' does not name a type
13 | ll calc(int m){
| ^~
a.cc: In function 'int main()':
a.cc:26:9: error: 'scanf' was not declared in this scope
26 | while(scanf("%d%d%d%d",&n,&m,&k,&l),n){
| ^~~~~
a.cc:27:5: error: 'set' was not declared in this scope
27 | set<string> names;
| ^~~
a.cc:27:9: error: 'string' was not declared in this scope
27 | set<string> names;
| ^~~~~~
a.cc:27:17: error: 'names' was not declared in this scope
27 | set<string> names;
| ^~~~~
a.cc:28:9: error: 'i' was not declared in this scope
28 | rep(i,n)scanf("%s%d",chara[i].s,&chara[i].x);
| ^
a.cc:28:5: error: 'rep' was not declared in this scope
28 | rep(i,n)scanf("%s%d",chara[i].s,&chara[i].x);
| ^~~
a.cc:33:5: error: 'like' was not declared in this scope
33 | like.clear(); dislike.clear();
| ^~~~
a.cc:33:19: error: 'dislike' was not declared in this scope
33 | like.clear(); dislike.clear();
| ^~~~~~~
a.cc:38:10: error: 'all' was not declared in this scope
38 | sort(all(like)); sort(all(dislike));
| ^~~
a.cc:38:5: error: 'sort' was not declared in this scope; did you mean 'short'?
38 | sort(all(like)); sort(all(dislike));
| ^~~~
| short
a.cc:41:18: error: 'min' was not declared in this scope; did you mean 'main'?
41 | int lo=0, hi=min(m,k)+1, mid;
| ^~~
| main
a.cc:43:7: error: 'mid' was not declared in this scope
43 | mid=(lo+hi)/2;
| ^~~
a.cc:44:10: error: 'calc' was not declared in this scope
44 | if(calc(mid)<=l)lo=mid; else hi=mid;
| ^~~~
a.cc:46:5: error: 'printf' was not declared in this scope
46 | printf("%d\n",lo);
| ^~~~~~
a.cc:1:1: note: 'printf' is defined in header '<cstdio>'; this is probably fixable by adding '#include <cstdio>'
+++ |+#include <cstdio>
1 | struct S{
|
s096566224 | p00665 | C++ | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define FR first
#define SC second
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, f, n) for(int i = (int)(f); i < (int)(n); i++)
#define each(a, b) for(auto& a : b)
typedef pair<int, string> P;
const int inf = 1LL << 55;
const int mod = 1e9 + 7;
int N, M, K, L;
set<string> favname;
vector<P> dic, fav, unf;
bool check(int k)
{
if(unf.size() < K-k+1) return true;
int l = 0;
for(int i = 0; i < k; i++) {
l += max(0, fav[i].first - unf[K-k].first);
if(fav[i].second > unf[K-k].second) l++;
}
return l <= L;
}
signed main()
{
cin.tie(0);
ios_base::sync_with_stdio(0);
cout << fixed << setprecision(12);
while(cin >> N >> M >> K >> L, N) {
dic.clear();
for(int i = 0; i < N; i++) {
string name; int x;
cin >> name >> x;
dic.push_back(P(-x, name));
}
favname.clear();
for(int i = 0; i < M; i++) {
string name; cin >> name;
favname.insert(name);
}
fav.clear();
unf.clear();
for(auto a : dic) {
if(favname.find(a.second) != favname.end()) fav.push_back(a);
else unf.push_back(a);
}
sort(all(fav));
sort(all(unf));
int lb = 0, ub = min(M, K) + 1;
while(lb + 1 < ub) {
int mb = (lb + ub) / 2;
if(check(mb)) lb = mb;
else ub = mb;
}
cout << lb << endl;
}
return 0;
} | a.cc: In function 'bool check(long long int)':
a.cc:28:13: error: no matching function for call to 'max(int, long long int)'
28 | l += max(0, fav[i].first - unf[K-k].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:28:13: note: deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
28 | l += max(0, fav[i].first - unf[K-k].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:28:13: note: mismatched types 'std::initializer_list<_Tp>' and 'int'
28 | l += max(0, fav[i].first - unf[K-k].first);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s503843119 | p00667 | C | #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
static const int MOD = 100000007;
typedef __int64 ll;
ll dp[6][100001];
ll divide(char prev, int count)
{
int limit;
ll ans;
limit = 5;
if (prev == '0' || prev == '8'){
limit = 3;
}
ans = 0;
while (count > 0){
ans = (ans + dp[limit][count]) % MOD;
count -= limit;
}
return (ans);
}
int main()
{
static char str[100001];
int i, j;
int count;
char prev;
ll ans;
dp[3][0] = dp[5][0] = 1;
for (i = 1; i <= 100000; i++){
for (j = 1; j <= 5; j++){
if (i - j >= 0){
dp[5][i] = (dp[5][i] + dp[5][i - j]) % MOD;
}
}
for (j = 1; j <= 3; j++){
if (i - j >= 0){
dp[3][i] = (dp[3][i] + dp[3][i - j]) % MOD;
}
}
}
while (1){
scanf("%s", str);
if (str[0] == '#'){
break;
}
ans = 1;
prev = str[0];
count = 1;
i = 1;
while (str[i] != '\0'){
if (str[i] == prev){
count++;
}
else {
ans = (ans * divide(prev, count)) % MOD;
prev = str[i];
count = 1;
}
i++;
}
ans = (ans * divide(prev, count)) % MOD;
printf("%lld\n", ans);
}
return (0);
} | main.c:1:10: fatal error: cstdio: No such file or directory
1 | #include <cstdio>
| ^~~~~~~~
compilation terminated.
|
s582169169 | p00668 | C++ | #include <bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define show(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define show(x)
#endif
s
typedef long long int ll;
typedef pair<int,int> pii;
template<typename T> using vec=std::vector<T>;
const int inf=1<<30;
const long long int infll=1LL<<62;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
os << "[";
for (const auto &v : vec) {
os << v << ",";
}
os << "]";
return os;
}
//range add,compute range max
template<class T> class segtree{
public:
int n,size;
vector<T> dat,sum; //????????????,?????????????§?????¶?????????????
segtree()=default;
segtree(int size_,T x){ init(size_,x); }
void init(int size_,T x){
size=size_;
n=1;
while(n<size) n*=2;
dat.assign(2*n-1,0);
sum.assign(2*n-1,0);
for(int i=0; i<size; ++i) add(i,i+1,x);
}
void add(int a,int b,T x){ add(a,b,x,0,0,n); }
T add(int a,int b,T x,int k,int l,int r){
if(b<=l or r<=a) return dat[k];
if(a<=l and r<=b){
sum[k]+=x;
return dat[k]+=x;
}
int m=(l+r)/2;
return dat[k]=max(add(a,b,x,2*k+1,l,m),add(a,b,x,2*k+2,m,r))+sum[k];
}
T query(int a,int b){ return query(a,b,0,0,n); }
T query(int a,int b,int k,int l,int r){
if(b<=l or r<=a) return numeric_limits<ll>::min();
if(a<=l and r<=b) return dat[k];
int m=(l+r)/2;
return max(query(a,b,2*k+1,l,m),query(a,b,2*k+2,m,r))+sum[k];
}
};
void solve(int q,int lim){
map<int,int> m1,m2; //segtree?????§???index
segtree<ll> seg(q,numeric_limits<int>::min());
int tail=0,size=0;
auto get_pos=[&](int x){ //?????????x??????????????????segtree?????§???index????±???????
int lb=-1,ub=q-1;
while(ub-lb>1){
int m=(lb+ub)/2;
if(seg.query(0,m+1)>=x) ub=m;
else lb=m;
}
return ub;
};
auto erase=[&](int k){ //segtree?????§???index??§k???????????????????????????
seg.add(k,k+1,numeric_limits<int>::min());
seg.add(k+1,q,-1);
};
rep(i,0,q){
int query,x;
cin >> query >> x;
if(query==0){
if(size==lim){
erase(get_pos(0));
--size;
}
m1[x]=tail;
m2[tail]=x;
ll tmp=seg.query(tail,tail+1);
seg.add(tail,tail+1,-tmp);
seg.add(tail,tail+1,size);
++tail;
++size;
}else if(query==1){
erase(get_pos(x-1));
--size;
}else if(query==2) cout << m2[get_pos(x-1)] << endl;
else{
erase(m1[x]);
--size;
}
}
cout << "end" << endl;
}
int main(){
std::cin.tie(0);
std::ios::sync_with_stdio(false);
cout.setf(ios::fixed);
cout.precision(10);
while(true){
int q,lim;
cin >> q >> lim;
if(q==0 and lim==0) break;
solve(q,lim);
}
return 0;
} | a.cc:13:1: error: 's' does not name a type
13 | s
| ^
a.cc: In member function 'T segtree<T>::query(int, int, int, int, int)':
a.cc:59:48: error: 'll' was not declared in this scope; did you mean 'l'?
59 | if(b<=l or r<=a) return numeric_limits<ll>::min();
| ^~
| l
a.cc:59:50: error: template argument 1 is invalid
59 | if(b<=l or r<=a) return numeric_limits<ll>::min();
| ^
a.cc: In function 'void solve(int, int)':
a.cc:68:13: error: 'll' was not declared in this scope
68 | segtree<ll> seg(q,numeric_limits<int>::min());
| ^~
a.cc:68:15: error: template argument 1 is invalid
68 | segtree<ll> seg(q,numeric_limits<int>::min());
| ^
a.cc:68:49: error: expression list treated as compound expression in initializer [-fpermissive]
68 | segtree<ll> seg(q,numeric_limits<int>::min());
| ^
a.cc: In lambda function:
a.cc:75:20: error: request for member 'query' in 'seg', which is of non-class type 'int'
75 | if(seg.query(0,m+1)>=x) ub=m;
| ^~~~~
a.cc: In lambda function:
a.cc:82:13: error: request for member 'add' in 'seg', which is of non-class type 'int'
82 | seg.add(k,k+1,numeric_limits<int>::min());
| ^~~
a.cc:83:13: error: request for member 'add' in 'seg', which is of non-class type 'int'
83 | seg.add(k+1,q,-1);
| ^~~
a.cc: In function 'void solve(int, int)':
a.cc:96:15: error: expected ';' before 'tmp'
96 | ll tmp=seg.query(tail,tail+1);
| ^~~~
| ;
a.cc:97:17: error: request for member 'add' in 'seg', which is of non-class type 'int'
97 | seg.add(tail,tail+1,-tmp);
| ^~~
a.cc:97:34: error: 'tmp' was not declared in this scope; did you mean 'tm'?
97 | seg.add(tail,tail+1,-tmp);
| ^~~
| tm
a.cc:98:17: error: request for member 'add' in 'seg', which is of non-class type 'int'
98 | seg.add(tail,tail+1,size);
| ^~~
|
s943601434 | p00668 | C++ | #include <stdio.h>
#include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <fstream>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <complex>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
using namespace std;
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) (EQ((a).real(),(b).real()) && EQ((a).imag(),(b).imag()))
const int MAX_N=1<<19;
// ZOgØðàÂO[ozñ
int dat[2*MAX_N-1];
int n;
int tail=0;
// io[©çindexðÁè
map<int,int> numToIndex;
// ú»
void init(int n_){
n=1;
// vfðñÌ׫æÉ
while(n<n_)n*=2;
fill(dat,dat+2*MAX_N-1,0);
for(int i = n-1; i < 2*MAX_N-1; i++)
dat[i]=INT_MAX;
}
//// kÔÚÌlðaÉÏX
//void update(int k,int a){
// k+=n-1;
// dat[k]=a;
// while(k>0){
// k=(k-1)/2;
// dat[k]=min(dat[k*2+1],dat[k*2+2]);
// }
//}
// idxÌÔðèÄAzñÌöÉÇÁ
void query0(int idx){
int k=tail;
k+=n-1;
dat[k]=idx;
// idx©çzñÌêðtø«Å«éæ¤É·é
numToIndex[idx]=tail;
// ãèȪçlðÁ³¹Ä¢
while(k>0){
k=(k-1)/2;
dat[k]++;
}
tail++;
}
// zñÌxÔÚÌvfðí
void query1(int x){
int k=x;
k+=n-1;
// í
dat[k]=INT_MAX;
// ãèȪçlðÁ³¹Ä¢
while(k>0){
k=(k-1)/2;
dat[k]--;
}
}
//// cÁÄévfð¦ÄkÔÚÌêÉ éÅÌÔðoÍ
//int query2(int a,int b,int k,int l,int r){
// if(r<=a||b<=l)
// return INT_MAX;
// if(a<=1&&r<=b)
// return dat[k];
// //int vl=query(a,b,k*2+1,l,(l+r)/2);
// //int vr=query(a,b,k*2+2,(l+r)/2,r);
// // ¶ÆEÌð¦é
// int vl=dat[k*2+1];
// int vr=dat[k*2+2];
//// return min(vl,vr);
//}
// ¡cÁÄ¢évf̤¿AidxÔÚÌÅÌÔðoÍ
int query2(int idx,int place=0,int child=0){
// ñªßéàÌ
if(2*place+1>=n-1){
if(idx==1){
if(dat[2*place+1]==INT_MAX)
return dat[2*place+2];
return dat[2*place+1];
}
return dat[2*place+2];
}
// ¶ÆEÌð¦é
int vl=dat[place*2+1];
int vr=dat[place*2+2];
// ¶ÉidxÔÚª¶Ý
int res;
if(idx<=vl)
res=query2(idx,place*2+1,vl);
// EÉidxÔÚª¶Ý
else
res=query2(idx-vl,place*2+2,vr);
return res;
}
// àÁÆàâvfðí·é
void oldDelete(int place=0){
if(2*place+1>=n-1){
// Ôðæ¾
int num=dat[2*place+1];
// tø«
int idx=numToIndex[num];
query1(idx);
return;
}
// ¶ÆEÌð¦é
int vl=dat[place*2+1];
// ¶ÉidxÔÚª¶Ý
int res;
if(vl>=1)
oldDelete(place*2+1);
// EÉidxÔÚª¶Ý
else
oldDelete(place*2+2);
}
// ÔªxÌÅÌðí
void query3(int x){
int index=numToIndex[x];
query1(index);
}
// [a,b)ÉcÁÄ¢éÅÌÌð½¹,
int query(int a,int b,int k,int l,int r){
if(r<=a||b<=l)
return INT_MAX;
if(a<=1&&r<=b)
return dat[k];
int vl=query(a,b,k*2+1,l,(l+r)/2);
int vr=query(a,b,k*2+2,(l+r)/2,r);
return min(vl,vr);
}
// Ô©çio[ðÁè
map<int,int> indexToNum;
void solve(){
int q,lim;
while(cin>>q>>lim&&q!=0){
init(q+1);
//n=q+1;
tail=0;
numToIndex.clear();
int kosu=0;
for(int i = 0; i < q; i++){
int qe,x;
cin>>qe>>x;
if(qe==0){
query0(x);
kosu++;
// àµlimðz¦½çAàÁÆàÃo^³ê½àÌ(idxªàÁÆà¬³¢àÌ)ðí·é
if(kosu>lim){
oldDelete();
kosu--;
}
}
else if(qe==1){
query1(x-1);
kosu--;
}
else if(qe==2)
cout<<query2(x)<<endl;
else{
query3(x);
kosu--;
}
}
cout<<"end"<<endl;
}
}
int main(){
solve();
return 0;
} | a.cc: In function 'void init(int)':
a.cc:40:16: error: 'INT_MAX' was not declared in this scope
40 | dat[i]=INT_MAX;
| ^~~~~~~
a.cc:16:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
15 | #include <cstring>
+++ |+#include <climits>
16 | #include <sstream>
a.cc: In function 'void query1(int)':
a.cc:71:12: error: 'INT_MAX' was not declared in this scope
71 | dat[k]=INT_MAX;
| ^~~~~~~
a.cc:71:12: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc: In function 'int query2(int, int, int)':
a.cc:98:32: error: 'INT_MAX' was not declared in this scope
98 | if(dat[2*place+1]==INT_MAX)
| ^~~~~~~
a.cc:98:32: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc: In function 'int query(int, int, int, int, int)':
a.cc:146:16: error: 'INT_MAX' was not declared in this scope
146 | return INT_MAX;
| ^~~~~~~
a.cc:146:16: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
|
s739215234 | p00668 | C++ | #include<iostream>
#include<queue>
using namespace std;
int main(){
int q,lim,query,x;
while(1){
deque<int> l;
cin >> q >> lim;
if(!q && !lim)break;
for(int i=0;i<q;i++){
cin >> query >> x;
if(query==0){
l.push_back(x);
if((int)l.size()>lim)l.pop_front();
}
if(query==1)l.erase(l.begin()+x-1);
if(query==2)cout << *(l.begin()+x-1) << endl;
if(query==3)l.erase(find(l.begin(),l.end(),x));
}
cout << "end" << endl;
}
} | a.cc: In function 'int main()':
a.cc:21:31: error: no matching function for call to 'find(std::deque<int>::iterator, std::deque<int>::iterator, int&)'
21 | if(query==3)l.erase(find(l.begin(),l.end(),x));
| ~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/bits/locale_facets.h:48,
from /usr/include/c++/14/bits/basic_ios.h:37,
from /usr/include/c++/14/ios:46,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: candidate: 'template<class _CharT2> typename __gnu_cxx::__enable_if<std::__is_char<_CharT2>::__value, std::istreambuf_iterator<_CharT> >::__type std::find(istreambuf_iterator<_CharT>, istreambuf_iterator<_CharT>, const _CharT2&)'
435 | find(istreambuf_iterator<_CharT> __first,
| ^~~~
/usr/include/c++/14/bits/streambuf_iterator.h:435:5: note: template argument deduction/substitution failed:
a.cc:21:31: note: 'std::_Deque_iterator<int, int&, int*>' is not derived from 'std::istreambuf_iterator<_CharT>'
21 | if(query==3)l.erase(find(l.begin(),l.end(),x));
| ~~~~^~~~~~~~~~~~~~~~~~~~~
|
s975603932 | p00668 | C++ | #include<cstdio>
#include<vector>
main(){for(int Q,L,q,x;scanf("%d%d",&Q,&L),Q;puts("end"))for(std::vector<int>v;Q--;){
if(v.size()>L)v.erase(v.begin());
if(scanf("%d%d",&q,&x),!q)v.push_back(x);
if(q==1)v.erase(v.begin()+x-1);
if(q==2)printf("%d\n",v[x-1]);
if(q==3)v.erase(std::find(v.begin(),v.end(),x));
}} | a.cc:3:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
3 | main(){for(int Q,L,q,x;scanf("%d%d",&Q,&L),Q;puts("end"))for(std::vector<int>v;Q--;){
| ^~~~
a.cc: In function 'int main()':
a.cc:8:30: error: 'find' is not a member of 'std'
8 | if(q==3)v.erase(std::find(v.begin(),v.end(),x));
| ^~~~
|
s523743732 | p00668 | C++ | #include <cstdio>
#include <map>
#define MAX_Q (400000)
#define ll I64
using namespace std;
typedef __int64 lint;
int bit[MAX_Q + 1];
void add(int pos, int val)
{
while (pos <= MAX_Q){
bit[pos] += val;
pos += pos & -pos;
}
}
int sum(int pos)
{
int ret = 0;
while (pos){
ret += bit[pos];
pos &= (pos - 1);
}
return (ret);
}
void print(int x, map<int, lint> val)
{
int l = 0, r = MAX_Q;
while (l != r){
int center = (l + r) / 2;
if (sum(center) < x){
l = center + 1;
}
else {
r = center;
}
}
printf("%lld\n", val[r]);
}
void erase(int x)
{
int l = 0, r = MAX_Q;
while (l != r){
int center = (l + r) / 2;
if (sum(center) < x){
l = center + 1;
}
else {
r = center;
}
}
add(r, -1);
}
int main()
{
int q, lim;
while (scanf("%d %d", &q, &lim), lim){
memset(bit, 0, sizeof(bit));
map<lint, int> pos;
map<int, lint> val;
int p = 1;
while (q--){
int qtype, x;
scanf("%d %lld", &qtype, &x);
if (qtype == 0){
add(p, 1);
pos[x] = p;
val[p++] = x;
if (sum(MAX_Q) > lim){
erase(1);
}
}
if (qtype == 1){
erase(x);
}
if (qtype == 2){
print(x, val);
}
if (qtype == 3){
add(pos[x], -1);
}
}
printf("end\n");
}
return (0);
} | a.cc:9:9: error: '__int64' does not name a type; did you mean '__int64_t'?
9 | typedef __int64 lint;
| ^~~~~~~
| __int64_t
a.cc:34:28: error: 'lint' was not declared in this scope; did you mean 'int'?
34 | void print(int x, map<int, lint> val)
| ^~~~
| int
a.cc:34:32: error: template argument 2 is invalid
34 | void print(int x, map<int, lint> val)
| ^
a.cc:34:32: error: template argument 4 is invalid
a.cc: In function 'void print(int, int)':
a.cc:49:29: error: invalid types 'int[int]' for array subscript
49 | printf("%lld\n", val[r]);
| ^
a.cc: In function 'int main()':
a.cc:75:17: error: 'memset' was not declared in this scope
75 | memset(bit, 0, sizeof(bit));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <map>
+++ |+#include <cstring>
3 |
a.cc:76:21: error: 'lint' was not declared in this scope; did you mean 'int'?
76 | map<lint, int> pos;
| ^~~~
| int
a.cc:76:30: error: template argument 1 is invalid
76 | map<lint, int> pos;
| ^
a.cc:76:30: error: template argument 3 is invalid
a.cc:76:30: error: template argument 4 is invalid
a.cc:77:30: error: template argument 4 is invalid
77 | map<int, lint> val;
| ^
a.cc:87:36: error: invalid types 'int[int]' for array subscript
87 | pos[x] = p;
| ^
a.cc:88:36: error: invalid types 'int[int]' for array subscript
88 | val[p++] = x;
| ^
a.cc:100:40: error: invalid types 'int[int]' for array subscript
100 | add(pos[x], -1);
| ^
|
s064633366 | p00668 | C++ | #include <cstdio>
#include <map>
#define MAX_Q (400000)
using namespace std;
typedef long long lint;
int bit[MAX_Q + 1];
void add(int pos, int val)
{
while (pos <= MAX_Q){
bit[pos] += val;
pos += pos & -pos;
}
}
int sum(int pos)
{
int ret = 0;
while (pos){
ret += bit[pos];
pos &= (pos - 1);
}
return (ret);
}
void print(int x, map<int, lint> val)
{
int l = 0, r = MAX_Q;
while (l != r){
int center = (l + r) / 2;
if (sum(center) < x){
l = center + 1;
}
else {
r = center;
}
}
printf("%lld\n", val[r]);
}
void erase(int x)
{
int l = 0, r = MAX_Q;
while (l != r){
int center = (l + r) / 2;
if (sum(center) < x){
l = center + 1;
}
else {
r = center;
}
}
add(r, -1);
}
int main()
{
int q, lim;
while (scanf("%d %d", &q, &lim), lim){
memset(bit, 0, sizeof(bit));
map<lint, int> pos;
map<int, lint> val;
int p = 1;
while (q--){
int qtype, x;
scanf("%d %lld", &qtype, &x);
if (qtype == 0){
add(p, 1);
pos[x] = p;
val[p++] = x;
if (sum(MAX_Q) > lim){
erase(1);
}
}
if (qtype == 1){
erase(x);
}
if (qtype == 2){
print(x, val);
}
if (qtype == 3){
add(pos[x], -1);
}
}
printf("end\n");
}
return (0);
} | a.cc: In function 'int main()':
a.cc:74:17: error: 'memset' was not declared in this scope
74 | memset(bit, 0, sizeof(bit));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include <map>
+++ |+#include <cstring>
3 |
|
s074605465 | p00668 | C++ | #include <cstdio>
#include <map>
#include <cstring>
#define MAX_Q (400000)
using namespace std;
typedef long long lint;
int bit[MAX_Q + 1];
lint val[MAX_Q + 1];
void add(int pos, int val)
{
while (pos <= MAX_Q){
bit[pos] += val;
pos += pos & -pos;
}
}
int sum(int pos)
{
int ret = 0;
while (pos){
ret += bit[pos];
pos &= (pos - 1);
}
return (ret);
}
int valid(int x)
{
int l = 0, r = MAX_Q;
while (l != r){
int center = (l + r) / 2;
if (sum(center) < x){
l = center + 1;
}
else {
r = center;
}
}
return (r);
}
int main()
{
int q, lim;
while (scanf("%d %d", &q, &lim), lim){
memset(bit, 0, sizeof(bit));
memset(val, 0, sizeof(val));
map<lint, int> pos;
int p = 1;
while (q--){
int qtype, x;
scanf("%d %lld", &qtype, &x);
if (qtype == 0){
add(p, 1);
pos[x] = p;
val[p++] = x;
if (sum(MAX_Q) > lim){
erase(1);
}
}
if (qtype == 1){
add(valid(x), -1);
}
if (qtype == 2){
printf("%d\n", val[valid(x)]);
}
if (qtype == 3){
add(pos[x], -1);
}
}
printf("end\n");
}
return (0);
} | a.cc: In function 'int main()':
a.cc:74:21: error: 'erase' was not declared in this scope
74 | erase(1);
| ^~~~~
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.