submission_id stringlengths 10 10 | problem_id stringlengths 6 6 | language stringclasses 3 values | code stringlengths 1 522k | compiler_output stringlengths 43 10.2k |
|---|---|---|---|---|
s640010208 | p03919 | C++ | #include <iostream>
#include <string>
int main() {
int H, W;
std::string S[30][30];
std::cin >> H >> W;
char str[26] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
for (int i = 0; i < H; i++)
for (int j = 0; j < W; j++)
std::cin >> S[i][j];
for (int i = 0; i < H; i++)
for (int j = 0; j < W; j++)
if (S[i][j] == "snuke") {
std::cout << str[j] << i << std::endl;
return 0;
}
} | a.cc:11:1: error: extended character is not valid in an identifier
11 |
| ^
a.cc: In function 'int main()':
a.cc:11:1: error: '\U000000a0' was not declared in this scope
11 |
| ^
a.cc:12:25: error: 'i' was not declared in this scope
12 | for (int i = 0; i < H; i++)
| ^
a.cc:13:33: error: 'j' was not declared in this scope
13 | for (int j = 0; j < W; j++)
| ^
|
s572404136 | p03919 | C++ | #include <iostream>
#include <string>
int main() {
int H, W;
std::string S[30][30];
std::cin >> H >> W;
char str[26] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
for (int i = 0; i < H; i++)
for (int j = 0; j < W; j++)
std::cin >> S[i][j];
for (int i = 0; i < H; i++)
for (int j = 0; j < W; j++)
if (S[i][j] == "snuke") {
std::cout << str[j] << i << std::endl;
return 0;
}
} | a.cc:11:1: error: extended character is not valid in an identifier
11 |
| ^
a.cc: In function 'int main()':
a.cc:11:1: error: '\U000000a0' was not declared in this scope
11 |
| ^
a.cc:12:25: error: 'i' was not declared in this scope
12 | for (int i = 0; i < H; i++)
| ^
a.cc:13:33: error: 'j' was not declared in this scope
13 | for (int j = 0; j < W; j++)
| ^
|
s061970684 | p03919 | C++ | #include <iostream>
#include <string>
int main() {
int H, W;
std::string S[30][30];
std::cin >> H >> W;
char str[25] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
for (int i = 0; i < H; i++)
for (int j = 0; j < W; j++)
std::cin >> S[i][j];
for (int i = 0; i < H; i++)
for (int j = 0; j < W; j++)
if (S[i][j] == "snuke") {
std::cout << str[j] << i << std::endl;
return 0;
}
} | a.cc: In function 'int main()':
a.cc:7:130: error: too many initializers for 'char [25]'
7 | char str[25] = { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z' };
| ^
|
s993942067 | p03919 | C | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <stdlib.h>
#include <stdbool.h>
#define MOD 1000000007
#define INFTY 2147400000
#define DEBUG 1
#define END printf("\n");return 0;
#define QS09(how_data,data) qsort(data,how_data,sizeof(long),(int (*)(const void *,const void *))qsort_09);
#define QS90(how_data,data) qsort(data,how_data,sizeof(long),(int (*)(const void *,const void *))qsort_90);
#define In(a) long a;scanf("%ld",&a);
#define Out(a) printf("%ld\n",a);
#define dprintf if(DEBUG)printf
#define MAKE_ARRAY_DATA In(how_data);long data[how_data];input_array(how_data,data);
void input_array(long how_data,long *data);
void output_array(long how_data,long *data);
void input_array2(long first , long second , long data[][2]);
void format_array(long how_data ,long *data,long what);
long get_random(long min, long max);
long factorial(long n);
long fibonacci(long n);
int qsort_09(const int *sys1 , const int *sys2);
int qsort_90(const int *sys1 , const int *sys2);
long sel_max(long a , long b);
long sel_min(long a , long b);
long array_max(long how_data,long *data);
long array_min(long how_data,long *data);
long array_search(long how_data,long *data,long what);
long can_DP(long how_data,long *data,long how_can,bool *can);
long array_sum(long how_data,long *data);
long Leven_dist(char *now , char *target);
long get_digit(long target);
long rounding(double target);
long roundingdown(double target);
long roundingup(double target);
long ncr(long n , long r);
long npr(long n , long r);
long nhr(long n , long r);
int fifw(long add,long *data);
long fifr(long *data);
void GRAPH_input(void);
void GRAPH_dfs(long now);
bool check_prime(long target);
//グローバル変数一覧
long fifo[1000]={0};//fifo[0]はデータ件数
long loop1,loop2,loop3,loop4,loop5,i_temp;
long g_ans=0; //answerグローバル変数用
typedef struct{
long how_vertex;
long how_edge;
long edge_data[1000][2];
bool aleady_searched_vertex[500];
bool all_searched;
} _GD;//GraphData
_GD GRAPH={0,0,{{0}},{0},0};
char c_temp;
//loop5 loop4 loop3 loop2 loop1
//--------------ここから
int main(void){
In(H);In(W);
for(loop1=0;loop1<H;loop1++){
for(loop2=0;loop2<W;loop2++){
char S[6]={'\0'};
scanf("%s",S);
if(S[0]=='s' && S[1]=='n' && S[2]==u){
printf("%c%d",loop2+'A',loop1+1);
END;
}
}
}
END;}
//--------------ここまで
void input_array(long how_data,long *data){
long loop;
for(loop=0;loop<how_data;loop++){
scanf("%ld",&data[loop]);
}
return ;
}
void output_array(long how_data,long *data){
long loop;
for(loop=0;loop<how_data-1;loop++){
printf("%ld ",data[loop]);
}
return ;
}
void input_array2(long first,long second,long data[][2]){
long loopA,loopB;
for(loopA=0;loopA<first;loopA++){
for(loopB=0;loopB<second;loopB++){
scanf("%ld",&data[loopA][loopB]);
}
}
return ;
}
void format_array(long how_data ,long *data,long what){
long loopA;
for(loopA=0;loopA<how_data;loopA++){
data[loopA]=what;
}
return ;
}
long get_random(long min, long max){ //指定の範囲から乱数を1つ返すやつ
//srand((unsigned int)time(0)); //現在時刻で疑似乱数初期化
rand();rand();rand();rand(); //乱数を空打ち
return (rand()%(max+1-min))+min;
}
long factorial(long n){//n!のMOD10^9+7を返すやつ
unsigned long long int ret=1;
for(long i=1;i<=n;i++)ret=(ret*i)%1000000007;
return (long)ret;
}
int qsort_09(const int *sys1 , const int *sys2){ //小さいのが上にくるやつ
//qsort(data,how_data,sizeof(long),(int (*)(const void *,const void *))qsort_09);
if(*sys1<*sys2){
return -1;
}else if(*sys1==*sys2){
return 0;
}else{
return 1;
}
}
int qsort_90(const int *sys1 , const int *sys2){ //大きいのが上にくるやつ
//qsort(data,how_data,sizeof(long),(int (*)(const void *,const void *))qsort_90);
if(*sys1<*sys2){
return 1;
}else if(*sys1==*sys2){
return 0;
}else{
return -1;
}
}
long fibonacci(long n){
switch(n){
case 0:return 0;
case 1:return 1;
default :return fibonacci(n-1)+fibonacci(n-2);
}
}
long sel_max(long a,long b){
if(a>b)return a;
return b;
}
long sel_min(long a,long b){
if(a>b)return b;
return a;
}
long can_DP(long how_data,long *data,long how_can,bool *can){//Typical DP Contest A
//data内で組み合わせられる和をcanに0 or 1で入れる
//返り値はパターン数
long loopA,loopB;
long ret=0;
for(loopA=0;loopA<how_can;loopA++){//初期化
can[loopA]=0;
}
can[0]=1;//絶対にありえる
for(loopA=0;loopA<how_data;loopA++){
for(loopB=how_can-1;loopB>=0;loopB--){
if(can[loopB]==1 && loopB+data[loopA]<how_can){
can[loopB+data[loopA]]=1;
}
}
}
for(loopA=0;loopA<how_can;loopA++){
if(can[loopA]==1){
ret++;
}
}
return ret;
}
long array_max(long how_data,long *data){
long loop;
long ret=data[0];
for(loop=0;loop<how_data;loop++){
if(ret<data[loop])ret=data[loop];
}
return ret;
}
long array_min(long how_data,long *data){
long loop;
long ret=data[0];
for(loop=0;loop<how_data;loop++){
if(ret>data[loop])ret=data[loop];
}
return ret;
}
long array_sum(long how_data,long *data){
long ret=0;
long loop;
for(loop=0;loop<how_data;loop++){
ret+=data[loop];
}
return ret;
}
long array_search(long how_data,long *data,long what){
long loop;
for(loop=0;loop<how_data;loop++){
if(data[loop]==what){
return loop;
}
}
return -1;
}
long Leven_dist(char *now , char *target){
long loopA,loopB;
//レーベンシュタイン距離を求める
// 参考文献
// http://nw.tsuda.ac.jp/class/algoB/c13.html (アルゴリズム理解)
// http://d.hatena.ne.jp/ohnishiakira/20090809/1249845529 (実装)
long len_now=strlen(now)+1;
long len_target=strlen(target)+1;
long d[len_now][len_target]; //計算用
for(loopA=0;loopA<len_now;loopA++) d[loopA][0]=loopA;
for(loopA=0;loopA<len_target;loopA++) d[0][loopA]=loopA;
for(loopA=1;loopA<len_now;loopA++){
for(loopB=1;loopB<len_target;loopB++){
long cost=(now[loopA-1]==target[loopB-1] ? 0:1);
d[loopA][loopB]=sel_min(sel_min(d[loopA-1][loopB]+1,d[loopA][loopB-1]+1),d[loopA-1][loopB-1]+cost);
}
}
return d[len_now-1][len_target-1];
}
long get_digit(long target){
return (long)(log10(target)+1);
}
long ncr(long n , long r){
//パスカルの三角形
long loopA,loopB;
long pascal[100][102]={{0}};
pascal[1][0]=1;
pascal[1][1]=1;
for(loopA=2;loopA<100;loopA++){
pascal[loopA][0]=1;
for(loopB=1;loopB<loopA;loopB++){
pascal[loopA][loopB]=pascal[loopA-1][loopB-1]+pascal[loopA-1][loopB];
}
pascal[loopA][loopA]=1;
}
return pascal[n][r];
}
long npr(long n, long r){
return ncr(n,r)*factorial(r);
}
long nhr(long n , long r){
return ncr(n+r-1,r);
}
long rounding(double target){
return (long)target+0.50;
}
long roundingup(double target){
return (long)ceil(target);
}
long roundingdown(double target){
return (long)floor(target);
}
int fifw(long add,long *data){
data[data[0]+1]=add;
data[0]++;
return data[0]; //現在のデータ件数を返す
}
long fifr(long *data){
long ret=data[1];
data[0]--;
for(int i=1;i<999;i++){
data[i]=data[i+1];
}
return ret;
}
void GRAPH_input(void){
scanf("%ld %ld\n",&GRAPH.how_vertex,&GRAPH.how_edge);
for(long loopA=0;loopA<GRAPH.how_edge;loopA++){
scanf("%ld %ld\n",&GRAPH.edge_data[loopA][0],&GRAPH.edge_data[loopA][1]);
}
return;
}
void GRAPH_dfs(long now){
GRAPH.aleady_searched_vertex[now]=1;
for(int loopA=0;loopA<GRAPH.how_edge;loopA++){
if(GRAPH.edge_data[loopA][0]==now && GRAPH.aleady_searched_vertex[GRAPH.edge_data[loopA][1]]==0){
GRAPH_dfs(GRAPH.edge_data[loopA][1]);
}
if(GRAPH.edge_data[loopA][1]==now && GRAPH.aleady_searched_vertex[GRAPH.edge_data[loopA][0]]==0){
GRAPH_dfs(GRAPH.edge_data[loopA][0]);
}
}
return ;
}
bool check_prime(long target){//素数判定、素数なら1
if(target==2)return 1;
if(target<=1 || target%2==0)return 0;
for(int loopA=3;loopA<=sqrt(target)+1;loopA+=2)if(target%loopA==0)return 0;
return 1;
}
| main.c: In function 'main':
main.c:76:48: error: 'u' undeclared (first use in this function)
76 | if(S[0]=='s' && S[1]=='n' && S[2]==u){
| ^
main.c:76:48: note: each undeclared identifier is reported only once for each function it appears in
|
s399040706 | p03919 | C++ | h,w = map(int, input().split())
for i in range(h):
s = input().split()
for j in range(w):
if s[j] == "snuke":
print("{}{}".format(chr(ord('A')+j), i+1)) | a.cc:1:1: error: 'h' does not name a type
1 | h,w = map(int, input().split())
| ^
|
s904274214 | p03919 | C++ | #inclde#include<iostream>
#include<vector>
#define r(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef pair<int,int>P;
int n,a[222][222],y,x,t,d[6],b[222][222],f;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
vector<P>v;
void make_dice(){
d[0]=t;
d[1]=f;
d[3]=7-f;
d[5]=7-t;
if(t==1){
if(f==3)d[2]=5,d[4]=2;
if(f==5)d[2]=4,d[4]=3;
if(f==4)d[2]=2,d[4]=5;
if(f==2)d[2]=3,d[4]=4;
}
if(t==2){
if(f==1)d[2]=4,d[4]=3;
if(f==4)d[2]=6,d[4]=1;
if(f==6)d[2]=3,d[4]=4;
if(f==3)d[2]=1,d[4]=6;
}
if(t==3){
if(f==1)d[2]=2,d[4]=5;
if(f==2)d[2]=6,d[4]=1;
if(f==6)d[2]=5,d[4]=2;
if(f==5)d[2]=1,d[4]=6;
}
if(t==4){
if(f==1)d[2]=5,d[4]=2;
if(f==2)d[2]=1,d[4]=6;
if(f==6)d[2]=2,d[4]=5;
if(f==5)d[2]=6,d[4]=1;
}
if(t==5){
if(f==3)d[2]=6,d[4]=1;
if(f==6)d[2]=4,d[4]=3;
if(f==4)d[2]=1,d[4]=6;
if(f==1)d[2]=3,d[4]=4;
}
if(t==6){
if(f==3)d[2]=2,d[4]=5;
if(f==5)d[2]=3,d[4]=4;
if(f==4)d[2]=5,d[4]=2;
if(f==2)d[2]=4,d[4]=3;
}
}
void rot1(){
swap(d[1],d[0]);
swap(d[0],d[3]);
swap(d[3],d[5]);
}
void rot2(){
swap(d[2],d[0]);
swap(d[0],d[4]);
swap(d[4],d[5]);
}
void rot3(){
swap(d[4],d[0]);
swap(d[0],d[2]);
swap(d[2],d[5]);
}
void rot4(){
swap(d[3],d[0]);
swap(d[0],d[1]);
swap(d[1],d[5]);
}
void rot(int p){
if(p==0)rot1();
if(p==1)rot2();
if(p==2)rot4();
if(p==3)rot3();
}
void v_set(){
r(i,4)v.push_back(P(d[i+1],i));
}
int main(){
while(cin>>n,n){
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
while(n--){
y=x=100;
cin>>t>>f;
make_dice();
while(1){
int flag=0;
v.clear();
v_set();
sort(v.begin(),v.end());
for(int i=3;i>=0;i--)if(v[i].first>3){
int xx=x+dx[v[i].second];
int yy=y+dy[v[i].second];
if(a[yy][xx]<a[y][x]){
x=xx,y=yy;
rot(v[i].second);
flag++;
break;
}
}
if(!flag){
a[y][x]++;
b[y][x]=d[0];
break;
}
}
}
int ans[6]={};
r(i,222)r(j,222)if(b[i][j])ans[b[i][j]-1]++;
cout<<ans[0];
r(i,5)cout<<' '<<ans[i+1];
cout<<endl;
}
}
| a.cc:1:2: error: invalid preprocessing directive #inclde; did you mean #include?
1 | #inclde#include<iostream>
| ^~~~~~
| include
a.cc: In function 'int main()':
a.cc:82:9: error: 'cin' was not declared in this scope
82 | while(cin>>n,n){
| ^~~
a.cc:3:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
2 | #include<vector>
+++ |+#include <iostream>
3 | #define r(i,n) for(int i=0;i<n;i++)
a.cc:83:5: error: 'memset' was not declared in this scope
83 | memset(a,0,sizeof(a));
| ^~~~~~
a.cc:3:1: note: 'memset' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
2 | #include<vector>
+++ |+#include <cstring>
3 | #define r(i,n) for(int i=0;i<n;i++)
a.cc:93:9: error: 'sort' was not declared in this scope; did you mean 'short'?
93 | sort(v.begin(),v.end());
| ^~~~
| short
a.cc:113:5: error: 'cout' was not declared in this scope
113 | cout<<ans[0];
| ^~~~
a.cc:113:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:115:11: error: 'endl' was not declared in this scope
115 | cout<<endl;
| ^~~~
a.cc:3:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
2 | #include<vector>
+++ |+#include <ostream>
3 | #define r(i,n) for(int i=0;i<n;i++)
|
s768189300 | p03919 | C++ | 15 10
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snuke snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake | a.cc:1:1: error: expected unqualified-id before numeric constant
1 | 15 10
| ^~
|
s369807325 | p03919 | C++ | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
int H, W; cin >> H >> W;
vector<vector<string> > vs(H);
FOR(i,0,H) {
FOR(j,0,W) {
cin >> vs[i];
}
}
FOR(y,0,H) {
FOR(x,0,W) {
if(s[y][x] == "sunuke") {
char c = 'A' + x;
cout << c << y + 1 << endl;
return 0;
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:28:11: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::__cxx11::basic_string<char> > >, std::vector<std::__cxx11::basic_string<char> > >::value_type' {aka 'std::vector<std::__cxx11::basic_string<char> >'})
28 | cin >> vs[i];
In file included from /usr/include/c++/14/iostream:42,
from a.cc:3:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
170 | operator>>(bool& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:170:24: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::__cxx11::basic_string<char> > >, std::vector<std::__cxx11::basic_string<char> > >::value_type' {aka 'std::vector<std::__cxx11::basic_string<char> >'} to 'bool&'
170 | operator>>(bool& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]'
174 | operator>>(short& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:174:25: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::__cxx11::basic_string<char> > >, std::vector<std::__cxx11::basic_string<char> > >::value_type' {aka 'std::vector<std::__cxx11::basic_string<char> >'} to 'short int&'
174 | operator>>(short& __n);
| ~~~~~~~^~~
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
177 | operator>>(unsigned short& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:177:34: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::__cxx11::basic_string<char> > >, std::vector<std::__cxx11::basic_string<char> > >::value_type' {aka 'std::vector<std::__cxx11::basic_string<char> >'} to 'short unsigned int&'
177 | operator>>(unsigned short& __n)
| ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]'
181 | operator>>(int& __n);
| ^~~~~~~~
/usr/include/c++/14/istream:181:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::__cxx11::basic_string<char> > >, std::vector<std::__cxx11::basic_string<char> > >::value_type' {aka 'std::vector<std::__cxx11::basic_string<char> >'} to 'int&'
181 | operator>>(int& __n);
| ~~~~~^~~
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
184 | operator>>(unsigned int& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:184:32: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::__cxx11::basic_string<char> > >, std::vector<std::__cxx11::basic_string<char> > >::value_type' {aka 'std::vector<std::__cxx11::basic_string<char> >'} to 'unsigned int&'
184 | operator>>(unsigned int& __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
188 | operator>>(long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:188:24: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::__cxx11::basic_string<char> > >, std::vector<std::__cxx11::basic_string<char> > >::value_type' {aka 'std::vector<std::__cxx11::basic_string<char> >'} to 'long int&'
188 | operator>>(long& __n)
| ~~~~~~^~~
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
192 | operator>>(unsigned long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:192:33: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::__cxx11::basic_string<char> > >, std::vector<std::__cxx11::basic_string<char> > >::value_type' {aka 'std::vector<std::__cxx11::basic_string<char> >'} to 'long unsigned int&'
192 | operator>>(unsigned long& __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
199 | operator>>(long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:199:29: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::__cxx11::basic_string<char> > >, std::vector<std::__cxx11::basic_string<char> > >::value_type' {aka 'std::vector<std::__cxx11::basic_string<char> >'} to 'long long int&'
199 | operator>>(long long& __n)
| ~~~~~~~~~~~^~~
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
203 | operator>>(unsigned long long& __n)
| ^~~~~~~~
/usr/include/c++/14/istream:203:38: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::__cxx11::basic_string<char> > >, std::vector<std::__cxx11::basic_string<char> > >::value_type' {aka 'std::vector<std::__cxx11::basic_string<char> >'} to 'long long unsigned int&'
203 | operator>>(unsigned long long& __n)
| ~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
219 | operator>>(float& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:219:25: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::__cxx11::basic_string<char> > >, std::vector<std::__cxx11::basic_string<char> > >::value_type' {aka 'std::vector<std::__cxx11::basic_string<char> >'} to 'float&'
219 | operator>>(float& __f)
| ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
223 | operator>>(double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:223:26: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::__cxx11::basic_string<char> > >, std::vector<std::__cxx11::basic_string<char> > >::value_type' {aka 'std::vector<std::__cxx11::basic_string<char> >'} to 'double&'
223 | operator>>(double& __f)
| ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
227 | operator>>(long double& __f)
| ^~~~~~~~
/usr/include/c++/14/istream:227:31: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::__cxx11::basic_string<char> > >, std::vector<std::__cxx11::basic_string<char> > >::value_type' {aka 'std::vector<std::__cxx11::basic_string<char> >'} to 'long double&'
227 | operator>>(long double& __f)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
328 | operator>>(void*& __p)
| ^~~~~~~~
/usr/include/c++/14/istream:328:25: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::__cxx11::basic_string<char> > >, std::vector<std::__cxx11::basic_string<char> > >::value_type' {aka 'std::vector<std::__cxx11::basic_string<char> >'} to 'void*&'
328 | operator>>(void*& __p)
| ~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
122 | operator>>(__istream_type& (*__pf)(__istream_type&))
| ^~~~~~~~
/usr/include/c++/14/istream:122:36: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<std::__cxx |
s141252662 | p03919 | C++ | foo | a.cc:1:1: error: 'foo' does not name a type
1 | foo
| ^~~
|
s269471327 | p03919 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int h,w;
string s;
cin >> h >> w;
for(int i=1;i<=h;i++){
for(int j=0;j<w;j++){
cin >> s;
if(s=="snuke"){
cout << ''A'+j << i << endl;
}
}
}
return 0;
}
| a.cc:13:41: error: empty character constant
13 | cout << ''A'+j << i << endl;
| ^~~
a.cc:13:44: warning: missing terminating ' character
13 | cout << ''A'+j << i << endl;
| ^
a.cc:13:44: error: missing terminating ' character
13 | cout << ''A'+j << i << endl;
| ^~~~~~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:13:41: error: unable to find character literal operator 'operator""A' with 'char' argument
13 | cout << ''A'+j << i << endl;
| ^~~
|
s378089664 | p03919 | C++ | #include <stdio.h>
int main(void)
{
char name[][];
int i,j;
int gyou;
int retu;
int atari_g,atari_r;
printf("行と列をスペースを空けて入力せよ。\n");
scanf("%d %d",&gyou,&retu);
if(gyou<1 || retu>26){
pritnf("もう一回入力してください\n");
scanf("%d %d",&gyou,&retu);
}
//配列の行の入力
for(i=1;i<=gyou;i++){
for(j=1; j<=retu;j++){
scanf("%s",&name[gyou][retu]);
}
}
//snukeの検索
for(i=1;i<=gyou;i++){
for(j=1; j<=retu;j++){
if("snuke" == name[gyou][retu]){
atari_g = gyou;
atari_r = retu;
}
}
}
//表示
printf("%d %d",&atari_g,&atari_r);
return 0;
}
| a.cc: In function 'int main()':
a.cc:5:14: error: declaration of 'name' as multidimensional array must have bounds for all dimensions except the first
5 | char name[][];
| ^~~~
a.cc:15:17: error: 'pritnf' was not declared in this scope; did you mean 'printf'?
15 | pritnf("もう一回入力してください\n");
| ^~~~~~
| printf
a.cc:22:37: error: 'name' was not declared in this scope; did you mean 'rename'?
22 | scanf("%s",&name[gyou][retu]);
| ^~~~
| rename
a.cc:31:39: error: 'name' was not declared in this scope; did you mean 'rename'?
31 | if("snuke" == name[gyou][retu]){
| ^~~~
| rename
|
s379461432 | p03919 | Java | import java.util.Scanner;
public class Snuke {
public static void main(String[] args) {
Snuke sn = new Snuke();
Scanner sc = new Scanner(System.in);
int col = sc.nextInt();
int row = sc.nextInt();
for(int i = 0; i < col;i++){
for(int j = 0 ;j < row;j++){
if(sc.next().equals("snuke")){
System.out.println();
System.out.println(sn.alpha(j+1)+(i+1));
}
}
}
}
public String alpha(int a){
switch(a){
case 1:
return "A";
case 2:
return "B";
case 3:
return "C";
case 4:
return "D";
case 5:
return "E";
case 6:
return "F";
case 7:
return "G";
case 8:
return "H";
case 9:
return "I";
case 10:
return "J";
case 11:
return "K";
case 12:
return "L";
case 13:
return "M";
case 14:
return "N";
case 15:
return "O";
case 16:
return "P";
case 17:
return "Q";
case 18:
return "R";
case 19:
return "S";
case 20:
return "T";
case 21:
return "U";
case 22:
return "V";
case 23:
return "W";
case 24:
return "X";
case 25:
return "Y";
case 26:
return "Z";
}
return null;
}
} | Main.java:3: error: class Snuke is public, should be declared in a file named Snuke.java
public class Snuke {
^
1 error
|
s243467443 | p03919 | Java | import java.util.Scanner;
public class Snuke {
public static void main(String[] args) {
Snuke sn = new Snuke();
Scanner sc = new Scanner(System.in);
int col = sc.nextInt();
int row = sc.nextInt();
for(int i = 0; i < col;i++){
for(int j = 0 ;j < row;j++){
if(sc.next().equals("snuke")){
System.out.println();
System.out.println(sn.alpha(j+1)+(i+1));
}
}
}
}
public String alpha(int a){
switch(a){
case 1:
return "A";
case 2:
return "B";
case 3:
return "C";
case 4:
return "D";
case 5:
return "E";
case 6:
return "F";
case 7:
return "G";
case 8:
return "H";
case 9:
return "I";
case 10:
return "J";
case 11:
return "K";
case 12:
return "L";
case 13:
return "M";
case 14:
return "N";
case 15:
return "O";
case 16:
return "P";
case 17:
return "Q";
case 18:
return "R";
case 19:
return "S";
case 20:
return "T";
case 21:
return "U";
case 22:
return "V";
case 23:
return "W";
case 24:
return "X";
case 25:
return "Y";
case 26:
return "Z";
}
return null;
}
}
| Main.java:3: error: class Snuke is public, should be declared in a file named Snuke.java
public class Snuke {
^
1 error
|
s080155265 | p03919 | C++ | #include <algorithm>//min/max/sort(rand-access it)/merge
#include <array>
#include <bitset>
// #include <chrono>//std::chrono::/system_clock/steady_clock/high_resolution_clock/duration
#include <climits>//INT_MAX/INT_MIN/ULLONG_MAX
#include <cmath>//fmin/fmax/fabs/sin(h)/cos(h)/tan(h)/exp/log/pow/sqrt/cbrt/ceil/floor/round/trunc
// #include <cstdio>//printf/scanf/fopen/fclose/fprintf/fscanf/snprintf/putc/puts/getc/gets
#include <cstdlib>//abs/atof/atoi/atol/atoll/strtod/strtof/..., srand/rand, calloc/malloc, exit, qsort
// #include <fstream>//ifstream/ofstream
#include <iomanip>//setfill/setw/setprecision/fixed/scientific
#include <iostream>//cin/cout/wcin/wcout/left/right/internal/dec/hex/oct/fixed/scientific
#include <iterator>
#include <limits>//numeric_limits<type>::max/min/lowest/epsilon/infinity/quiet_NaN/signaling_NaN
#include <list>
#include <new>
#include <queue>
#include <string>//stoi/stol/stoul/stoll/stoull/stof/stod/stold/to_string/getline
#include <tuple>
#include <utility>//pair
#include <valarray>
#include <vector>
#define PRIME_SHORT 10007
#define PRIME 1000000007
using namespace std;
typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef pair<ull, int> puli;
typedef pair<double, int> pdi;
typedef pair<ll, ll> pllll;
typedef pair<ull, ull> pulul;
typedef pair<double, double> pdd;
typedef tuple<int, int, int> ti3;
typedef tuple<int, int, int, int> ti4;
const bool debug = false;
template<typename T> void rar(size_t n, T* a);
template<typename T> void rar2(size_t n, size_t m, T** a);
template<typename T> T ipow(T base, T exp);
inline size_t left(size_t current, bool swap = false);
inline size_t right(size_t current, bool swap = false);
template<typename T> inline T griddist(T x, T y, T s, T t);
template<typename T> inline T griddist(pair<T, T> one, pair<T, T> two);
template<typename T> inline T griddist(tuple<T, T> one, tuple<T, T> two);
template<typename T> inline T sqeucldist(T x, T y, T s, T t);
template<typename T> inline T sqeucldist(pair<T, T> one, pair<T, T> two);
template<typename T> inline T sqeucldist(tuple<T, T> one, tuple<T, T> two);
inline ull modadd(ull a, ull b, int mod);
inline ull modmult(ull a, ull b, int mod);
int main(void) {
int n;
cin >> n;
int m;
cin >> m;
for (size_t i = 0; i < n; ++i) {
for (size_t j = 0; j < m; ++j) {
string s;
cin >> s;
if (s.equals("snuke")) {
char a = 'A' + j;
cout << a << (i+1) << endl;
goto end;
}
}
}
end:
return 0;
}
template<typename T>
void rar(size_t n, T* a) {
for (size_t i = 0; i < n; ++i) cin >> a[i];
return;
}
template<typename T>
void rar2(size_t n, int m, T** a) {
for (int i = 0; i < n; ++i) {
a[i] = new int[m];
for (int j = 0; j < m; ++j) cin >> a[i][j];
} return;
}
template<typename T>
T ipow(T base, T exp) {
T result = 1;
while (exp) {
if (exp & 1) result *= base;
exp >>= 1;
base *= base;
}
return result;
}
inline size_t left(size_t current, bool swap) {
return swap ? right(current) : 2*current+1;
}
inline size_t right(size_t current, bool swap) {
return swap ? left(current) : 2*(current+1);
}
template<typename T>
inline T griddist(T x, T y, T s, T t) {
return abs(x-s) + abs(y-t);
}
template<typename T>
inline T griddist(pair<T, T> one, pair<T, T> two) {
return abs(one.first - two.first) + abs(one.second - two.second);
}
template<typename T>
inline T griddist(tuple<T, T> one, tuple<T, T> two) {
return abs(get<0>(one) - get<0>(two)) + abs(get<1>(one) - get<1>(two));
}
template<typename T>
inline T sqeucldist(T x, T y, T s, T t) {
T a = x-s;
T b = y-t;
return a*a+b*b;
}
template<typename T>
inline T sqeucldist(pair<T, T> one, pair<T, T> two) {
T a = one.first - two.first;
T b = one.second - two.second;
return a*a+b*b;
}
template<typename T>
inline T sqeucldist(tuple<T, T> one, tuple<T, T> two) {
T a = get<0>(one) - get<0>(two);
T b = get<1>(one) - get<1>(two);
return a*a+b*b;
}
inline ull modadd(ull a, ull b, int mod) {
return ((a%mod) + (b%mod))%mod;
}
inline ull modmult(ull a, ull b, int mod) {
return ((a%mod)*(b%mod))%mod;
}
| a.cc: In function 'int main()':
a.cc:72:19: error: 'std::string' {aka 'class std::__cxx11::basic_string<char>'} has no member named 'equals'
72 | if (s.equals("snuke")) {
| ^~~~~~
|
s858964012 | p03919 | C++ | import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.BufferedWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.Writer;
import java.io.OutputStreamWriter;
import java.io.InputStream;
/**
* Built using CHelper plug-in
* Actual solution is at the top
*
* @author Alex
*/
public class Main {
public static void main(String[] args) {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
OutputWriter out = new OutputWriter(outputStream);
A solver = new A();
solver.solve(1, in, out);
out.close();
}
static class A {
public void solve(int testNumber, InputReader in, OutputWriter out) {
int rows = in.readInt();
int cols = in.readInt();
String[][] tab = new String[rows][cols];
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
tab[row][col] = in.next();
if (tab[row][col].equals("snuke")) {
out.printLine(((char) (col + 'A')) + Integer.toString(row + 1));
return;
}
}
}
}
}
static class InputReader {
private InputStream stream;
private byte[] buf = new byte[1024];
private int curChar;
private int numChars;
private InputReader.SpaceCharFilter filter;
public InputReader(InputStream stream) {
this.stream = stream;
}
public int read() {
if (numChars == -1) {
throw new InputMismatchException();
}
if (curChar >= numChars) {
curChar = 0;
try {
numChars = stream.read(buf);
} catch (IOException e) {
throw new InputMismatchException();
}
if (numChars <= 0) {
return -1;
}
}
return buf[curChar++];
}
public int readInt() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
int sgn = 1;
if (c == '-') {
sgn = -1;
c = read();
}
int res = 0;
do {
if (c < '0' || c > '9') {
throw new InputMismatchException();
}
res *= 10;
res += c - '0';
c = read();
} while (!isSpaceChar(c));
return res * sgn;
}
public String readString() {
int c = read();
while (isSpaceChar(c)) {
c = read();
}
StringBuilder res = new StringBuilder();
do {
if (Character.isValidCodePoint(c)) {
res.appendCodePoint(c);
}
c = read();
} while (!isSpaceChar(c));
return res.toString();
}
public boolean isSpaceChar(int c) {
if (filter != null) {
return filter.isSpaceChar(c);
}
return isWhitespace(c);
}
public static boolean isWhitespace(int c) {
return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
}
public String next() {
return readString();
}
public interface SpaceCharFilter {
public boolean isSpaceChar(int ch);
}
}
static class OutputWriter {
private final PrintWriter writer;
public OutputWriter(OutputStream outputStream) {
writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)));
}
public OutputWriter(Writer writer) {
this.writer = new PrintWriter(writer);
}
public void print(Object... objects) {
for (int i = 0; i < objects.length; i++) {
if (i != 0) {
writer.print(' ');
}
writer.print(objects[i]);
}
}
public void printLine(Object... objects) {
print(objects);
writer.println();
}
public void close() {
writer.close();
}
}
}
| a.cc:1:1: error: 'import' does not name a type
1 | import java.io.OutputStream;
| ^~~~~~
a.cc:1:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:2:1: error: 'import' does not name a type
2 | import java.io.IOException;
| ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:3:1: error: 'import' does not name a type
3 | import java.io.InputStream;
| ^~~~~~
a.cc:3:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:4:1: error: 'import' does not name a type
4 | import java.io.OutputStream;
| ^~~~~~
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.PrintWriter;
| ^~~~~~
a.cc:5:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:6:1: error: 'import' does not name a type
6 | import java.io.BufferedWriter;
| ^~~~~~
a.cc:6:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:7:1: error: 'import' does not name a type
7 | import java.util.InputMismatchException;
| ^~~~~~
a.cc:7:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:8:1: error: 'import' does not name a type
8 | import java.io.IOException;
| ^~~~~~
a.cc:8:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:9:1: error: 'import' does not name a type
9 | import java.io.Writer;
| ^~~~~~
a.cc:9:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:10:1: error: 'import' does not name a type
10 | import java.io.OutputStreamWriter;
| ^~~~~~
a.cc:10:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:11:1: error: 'import' does not name a type
11 | import java.io.InputStream;
| ^~~~~~
a.cc:11:1: note: C++20 'import' only available with '-fmodules-ts'
a.cc:18:1: error: expected unqualified-id before 'public'
18 | public class Main {
| ^~~~~~
|
s427381824 | p03919 | C++ | #include<iostream>
using namespace std;
int main()
{
// 整数の入力
int a,b;
cin >> a >> b;
int i,j;
string s;
string s1 = "snuke";
for(i=0;i<a;i++){
for(j=0;j<b;j++){
cin >> s;
if(strcmp(s,s1)==0)break;
}
}
// 出力
cout << 'A'+i << j << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:16:28: error: 'strcmp' was not declared in this scope
16 | if(strcmp(s,s1)==0)break;
| ^~~~~~
a.cc:2:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
1 | #include<iostream>
+++ |+#include <cstring>
2 | using namespace std;
|
s936627083 | p03919 | C++ | #define _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES 1
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <random>
const long long INF = 10000000000000000;
using namespace std;
int main(){
int H,W;
cin>>H>>W;
vector <vector<string>> S(H,W);
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
cin>>S[i][j];
}
}
for(int i=0;i<H;i++){
for(int j=0;j<W;j++){
if(S[i][j]=="snuke"){
printf("%c%d\n",65+j,i+1);
return 0;
}
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:26:38: error: no matching function for call to 'std::vector<std::vector<std::__cxx11::basic_string<char> > >::vector(int&, int&)'
26 | vector <vector<string>> S(H,W);
| ^
In file included from /usr/include/c++/14/vector:66,
from a.cc:4:
/usr/include/c++/14/bits/stl_vector.h:707:9: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with <template-parameter-2-2> = _InputIterator; _Tp = std::vector<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::vector<std::__cxx11::basic_string<char> > >]'
707 | vector(_InputIterator __first, _InputIterator __last,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:707:9: note: template argument deduction/substitution failed:
In file included from /usr/include/c++/14/bits/stl_iterator_base_funcs.h:66,
from /usr/include/c++/14/string:47,
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/istream:40,
from /usr/include/c++/14/sstream:40,
from a.cc:3:
/usr/include/c++/14/bits/stl_iterator_base_types.h: In substitution of 'template<class _InIter> using std::_RequireInputIter = std::__enable_if_t<((bool)std::is_convertible<typename std::iterator_traits< <template-parameter-1-1> >::iterator_category, std::input_iterator_tag>::value)> [with _InIter = int]':
/usr/include/c++/14/bits/stl_vector.h:705:9: required from here
705 | typename = std::_RequireInputIter<_InputIterator>>
| ^~~~~~~~
/usr/include/c++/14/bits/stl_iterator_base_types.h:252:57: error: no type named 'iterator_category' in 'struct std::iterator_traits<int>'
252 | input_iterator_tag>::value>;
| ^~~~~
/usr/include/c++/14/bits/stl_vector.h:678:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = std::vector<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::vector<std::__cxx11::basic_string<char> > >; allocator_type = std::allocator<std::vector<std::__cxx11::basic_string<char> > >]'
678 | vector(initializer_list<value_type> __l,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:678:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<std::vector<std::__cxx11::basic_string<char> > >'
678 | vector(initializer_list<value_type> __l,
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:659:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::vector<std::__cxx11::basic_string<char> > >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<std::__cxx11::basic_string<char> > >]'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:659:23: note: no known conversion for argument 1 from 'int' to 'std::vector<std::vector<std::__cxx11::basic_string<char> > >&&'
659 | vector(vector&& __rv, const __type_identity_t<allocator_type>& __m)
| ~~~~~~~~~^~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = std::vector<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::vector<std::__cxx11::basic_string<char> > >; allocator_type = std::allocator<std::vector<std::__cxx11::basic_string<char> > >; std::false_type = std::false_type]'
640 | vector(vector&& __rv, const allocator_type& __m, false_type)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:640:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = std::vector<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::vector<std::__cxx11::basic_string<char> > >; allocator_type = std::allocator<std::vector<std::__cxx11::basic_string<char> > >; std::true_type = std::true_type]'
635 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:635:7: note: candidate expects 3 arguments, 2 provided
/usr/include/c++/14/bits/stl_vector.h:624:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, std::__type_identity_t<_Alloc>&) [with _Tp = std::vector<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::vector<std::__cxx11::basic_string<char> > >; std::__type_identity_t<_Alloc> = std::allocator<std::vector<std::__cxx11::basic_string<char> > >]'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:624:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<std::vector<std::__cxx11::basic_string<char> > >&'
624 | vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = std::vector<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::vector<std::__cxx11::basic_string<char> > >]'
620 | vector(vector&&) noexcept = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:620:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = std::vector<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::vector<std::__cxx11::basic_string<char> > >]'
601 | vector(const vector& __x)
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:601:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const value_type&, const allocator_type&) [with _Tp = std::vector<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::vector<std::__cxx11::basic_string<char> > >; size_type = long unsigned int; value_type = std::vector<std::__cxx11::basic_string<char> >; allocator_type = std::allocator<std::vector<std::__cxx11::basic_string<char> > >]'
569 | vector(size_type __n, const value_type& __value,
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:569:47: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<std::__cxx11::basic_string<char> > >::value_type&' {aka 'const std::vector<std::__cxx11::basic_string<char> >&'}
569 | vector(size_type __n, const value_type& __value,
| ~~~~~~~~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(size_type, const allocator_type&) [with _Tp = std::vector<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::vector<std::__cxx11::basic_string<char> > >; size_type = long unsigned int; allocator_type = std::allocator<std::vector<std::__cxx11::basic_string<char> > >]'
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:556:51: note: no known conversion for argument 2 from 'int' to 'const std::vector<std::vector<std::__cxx11::basic_string<char> > >::allocator_type&' {aka 'const std::allocator<std::vector<std::__cxx11::basic_string<char> > >&'}
556 | vector(size_type __n, const allocator_type& __a = allocator_type())
| ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = std::vector<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::vector<std::__cxx11::basic_string<char> > >; allocator_type = std::allocator<std::vector<std::__cxx11::basic_string<char> > >]'
542 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:542:7: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = std::vector<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::vector<std::__cxx11::basic_string<char> > >]'
531 | vector() = default;
| ^~~~~~
/usr/include/c++/14/bits/stl_vector.h:531:7: note: candidate expects 0 arguments, 2 provided
|
s433626183 | p03919 | C++ | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main(){
int h,w;
char m[6];
scanf(" %d %d",&h,&w);
for(int i=1;i<=h;i++){
for(int j=0;j<w;j++){
scanf(" %s",m);
if(strcmp(m,"snuke")==0){
char a='A'+j;
cout << a << i << endl;
}
}
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:16:10: error: 'strcmp' was not declared in this scope
16 | if(strcmp(m,"snuke")==0){
| ^~~~~~
a.cc:4:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
3 | #include<algorithm>
+++ |+#include <cstring>
4 | #include<string>
|
s467711423 | p03919 | C++ | h,w = gets.split.map(&:to_i)
h.times{|i|
d = gets.chomp.split
j = d.index("snuke")
if j
printf "%c%d\n",65+j,i+1
exit
end
}
| a.cc:1:1: error: 'h' does not name a type
1 | h,w = gets.split.map(&:to_i)
| ^
|
s514666904 | p03919 | C++ |
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
int h, w;
int main(void)
{
scanf("%d %d", &h, &w);
for (int i = 0; i < h; ++i)
{
for (int j = 0; j < w; ++j)
{
char str[10];
scanf("%s", str);
if (strcmp(str, "snuke") == 0)
{
printf("%c",'A' + j);
printf("%d\n", i + 1);
}
}
}
return 0;
} | a.cc: In function 'int main()':
a.cc:33:29: error: 'strcmp' was not declared in this scope
33 | if (strcmp(str, "snuke") == 0)
| ^~~~~~
a.cc:20:1: note: 'strcmp' is defined in header '<cstring>'; this is probably fixable by adding '#include <cstring>'
19 | #include <queue>
+++ |+#include <cstring>
20 | using namespace std;
|
s587305933 | p03919 | C++ | #include "bits/stdc++.h"
#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;
void solve() {
#ifdef _WIN32
istream &cin = ifstream("input.txt");
#endif
int h, w;
string s;
cin >> h >> w;
rep(i, h) {
rep(j, w) {
cin >> s;
if (s == "snuke") {
cout << (char)('A' + j) << i + 1 << endl;
}
}
}
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
#ifdef _WIN32
system("PAUSE");
#endif
return 0;
}#include "bits/stdc++.h"
#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;
void solve() {
#ifdef _WIN32
istream &cin = ifstream("input.txt");
#endif
int h, w;
string s;
cin >> h >> w;
rep(i, h) {
rep(j, w) {
cin >> s;
if (s == "snuke") {
cout << (char)('A' + j) << i + 1 << endl;
}
}
}
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
#ifdef _WIN32
system("PAUSE");
#endif
return 0;
} | a.cc:45:2: error: stray '#' in program
45 | }#include "bits/stdc++.h"
| ^
a.cc:45:3: error: 'include' does not name a type
45 | }#include "bits/stdc++.h"
| ^~~~~~~
a.cc:57:6: error: redefinition of 'void solve()'
57 | void solve() {
| ^~~~~
a.cc:13:6: note: 'void solve()' previously defined here
13 | void solve() {
| ^~~~~
a.cc:79:5: error: redefinition of 'int main()'
79 | int main() {
| ^~~~
a.cc:35:5: note: 'int main()' previously defined here
35 | int main() {
| ^~~~
|
s181259135 | p03920 | C | #include <stdio.h>
int main(){
nong int i;
long int n;
long int a;
long int sum=0;
scanf("%ld",&n);
for(i=1;i<=n;i++){
a=sum;
if((a+i)==n){
printf("%ld\n",i);
break;
}
if((n-(a+i))>=i+1){
printf("%ld\n",i);
sum+=i;
}
}
return 0;
} | main.c: In function 'main':
main.c:3:3: error: 'nong' undeclared (first use in this function)
3 | nong int i;
| ^~~~
main.c:3:3: note: each undeclared identifier is reported only once for each function it appears in
main.c:3:7: error: expected ';' before 'int'
3 | nong int i;
| ^~~~
| ;
main.c:8:7: error: 'i' undeclared (first use in this function)
8 | for(i=1;i<=n;i++){
| ^
|
s245693235 | p03920 | C++ | n = int(input())
ans = []
for i in range(1, n+1):
if n - i >= i+1 or n - i == 0:
ans.append(i)
n -= i
for i in range(len(ans)):
print(ans[i]) | a.cc:1:1: error: 'n' does not name a type
1 | n = int(input())
| ^
|
s106837169 | p03920 | C++ | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = LLONG_MAX;
const ll MOD = 1e9 + 7;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
ll N;
cin >> N;
set<int> st;
for (int i = 1;; i++) {
sum += i;
st.insert(i);
if (sum >= N) {
int diff = sum - N;
if (diff != 0) {
st.erase(st.find(diff));
}
for (auto num : st) {
cout << num << endl;
}
return 0;
}
}
cout << cnt << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:18:9: error: 'sum' was not declared in this scope
18 | sum += i;
| ^~~
a.cc:31:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
31 | cout << cnt << endl;
| ^~~
| int
|
s999158801 | p03920 | C++ | #include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main (){
long long int a;
cin >>a ;
for(long long int i=1;(i+1)*(i+2)<=2*a;i++){
cout << i<< endl;
}
int b=i;
if(a-(b-1)*(b-2)/2 !=0){
cout << a-(b-1)*(b-2)/2 << endl;
return 0;
}
else{
cout << b+1 << endl;
return 0;
}
}
| a.cc: In function 'int main()':
a.cc:19:13: error: 'i' was not declared in this scope
19 | int b=i;
| ^
|
s180616664 | p03920 | C++ | #include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main (){
long long int a;
cin >>a ;
for(long long int i=0;i*(i+1)<2*a;i++){
cout << i<< endl;
}
cout << a-(b-1)*(b-2)/2 << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:20:18: error: 'b' was not declared in this scope
20 | cout << a-(b-1)*(b-2)/2 << endl;
| ^
|
s449846079 | p03920 | C++ | #include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int main (){
long long int a;
cin >>a ;
for(int i=0;i*i<4*a;i++){
if(i*(i+1)/2 > a){
long int b =i
for(int i=1;i<b-1;i++){
cout << i << endl;
}
cout << a-(b-1)*(b-2)/2 << endl;
return 0;
}
}
}
| a.cc: In function 'int main()':
a.cc:20:7: error: expected ',' or ';' before 'for'
20 | for(int i=1;i<b-1;i++){
| ^~~
a.cc:20:28: error: expected ';' before ')' token
20 | for(int i=1;i<b-1;i++){
| ^
| ;
|
s673994455 | p03920 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,sum=0; cin>>n;
vector<int> ans;
for(int i=1;i<=n;i++){
if(sum+i>n&&sum<n){
sum+=i;
ans.push_back(i);
break;
}
sum+=i;
ans.push_back(i);
}
ans.erase((int)(sum-n));
for(auto i : ans){
cout<<ans<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:17:12: error: no matching function for call to 'std::vector<int>::erase(int)'
17 | ans.erase((int)(sum-n));
| ~~~~~~~~~^~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
1536 | erase(const_iterator __position)
| ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note: no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
1536 | erase(const_iterator __position)
| ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
1564 | erase(const_iterator __first, const_iterator __last)
| ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate expects 2 arguments, 1 provided
a.cc:20:9: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<int>')
20 | cout<<ans<<endl;
| ~~~~^~~~~
| | |
| | std::vector<int>
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::vector<int>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::vector<int>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::vector<int>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::vector<int>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_trait |
s506170104 | p03920 | C++ | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,sum=0; cin>>n;
vector<int> ans;
for(int i=1;i<=n;i++){
if(sum+i>n&&sum<n){
sum+=i;
ans.push_back(i);
break;
}
sum+=i;
ans.push_back(i);
}
ans.erase(sum-n);
for(auto i : ans){
cout<<ans<<endl;
}
return 0;
} | a.cc: In function 'int main()':
a.cc:17:12: error: no matching function for call to 'std::vector<int>::erase(int)'
17 | ans.erase(sum-n);
| ~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/vector:66,
from /usr/include/c++/14/functional:64,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1536:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
1536 | erase(const_iterator __position)
| ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1536:28: note: no known conversion for argument 1 from 'int' to 'std::vector<int>::const_iterator'
1536 | erase(const_iterator __position)
| ~~~~~~~~~~~~~~~^~~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate: 'std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::erase(const_iterator, const_iterator) [with _Tp = int; _Alloc = std::allocator<int>; iterator = std::vector<int>::iterator; const_iterator = std::vector<int>::const_iterator]'
1564 | erase(const_iterator __first, const_iterator __last)
| ^~~~~
/usr/include/c++/14/bits/stl_vector.h:1564:7: note: candidate expects 2 arguments, 1 provided
a.cc:20:9: error: no match for 'operator<<' (operand types are 'std::ostream' {aka 'std::basic_ostream<char>'} and 'std::vector<int>')
20 | cout<<ans<<endl;
| ~~~~^~~~~
| | |
| | std::vector<int>
| std::ostream {aka std::basic_ostream<char>}
In file included from /usr/include/c++/14/istream:41,
from /usr/include/c++/14/sstream:40,
from /usr/include/c++/14/complex:45,
from /usr/include/c++/14/ccomplex:39,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:127:
/usr/include/c++/14/ostream:116:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ostream_type& (*)(__ostream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:116:36: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_ostream<char>::__ostream_type& (*)(std::basic_ostream<char>::__ostream_type&)' {aka 'std::basic_ostream<char>& (*)(std::basic_ostream<char>&)'}
116 | operator<<(__ostream_type& (*__pf)(__ostream_type&))
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:125:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(__ios_type& (*)(__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>; __ios_type = std::basic_ios<char>]'
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ^~~~~~~~
/usr/include/c++/14/ostream:125:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::basic_ostream<char>::__ios_type& (*)(std::basic_ostream<char>::__ios_type&)' {aka 'std::basic_ios<char>& (*)(std::basic_ios<char>&)'}
125 | operator<<(__ios_type& (*__pf)(__ios_type&))
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:135:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ^~~~~~~~
/usr/include/c++/14/ostream:135:30: note: no known conversion for argument 1 from 'std::vector<int>' to 'std::ios_base& (*)(std::ios_base&)'
135 | operator<<(ios_base& (*__pf) (ios_base&))
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/ostream:174:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
174 | operator<<(long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:174:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'long int'
174 | operator<<(long __n)
| ~~~~~^~~
/usr/include/c++/14/ostream:178:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
178 | operator<<(unsigned long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:178:32: note: no known conversion for argument 1 from 'std::vector<int>' to 'long unsigned int'
178 | operator<<(unsigned long __n)
| ~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:182:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(bool) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
182 | operator<<(bool __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:182:23: note: no known conversion for argument 1 from 'std::vector<int>' to 'bool'
182 | operator<<(bool __n)
| ~~~~~^~~
In file included from /usr/include/c++/14/ostream:1022:
/usr/include/c++/14/bits/ostream.tcc:96:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(short int) [with _CharT = char; _Traits = std::char_traits<char>]'
96 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:97:22: note: no known conversion for argument 1 from 'std::vector<int>' to 'short int'
97 | operator<<(short __n)
| ~~~~~~^~~
/usr/include/c++/14/ostream:189:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(short unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
189 | operator<<(unsigned short __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:189:33: note: no known conversion for argument 1 from 'std::vector<int>' to 'short unsigned int'
189 | operator<<(unsigned short __n)
| ~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/ostream.tcc:110:5: note: candidate: 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char; _Traits = std::char_traits<char>]'
110 | basic_ostream<_CharT, _Traits>::
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/ostream.tcc:111:20: note: no known conversion for argument 1 from 'std::vector<int>' to 'int'
111 | operator<<(int __n)
| ~~~~^~~
/usr/include/c++/14/ostream:200:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
200 | operator<<(unsigned int __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:200:31: note: no known conversion for argument 1 from 'std::vector<int>' to 'unsigned int'
200 | operator<<(unsigned int __n)
| ~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:211:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
211 | operator<<(long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:211:28: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long int'
211 | operator<<(long long __n)
| ~~~~~~~~~~^~~
/usr/include/c++/14/ostream:215:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long unsigned int) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
215 | operator<<(unsigned long long __n)
| ^~~~~~~~
/usr/include/c++/14/ostream:215:37: note: no known conversion for argument 1 from 'std::vector<int>' to 'long long unsigned int'
215 | operator<<(unsigned long long __n)
| ~~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/ostream:231:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
231 | operator<<(double __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:231:25: note: no known conversion for argument 1 from 'std::vector<int>' to 'double'
231 | operator<<(double __f)
| ~~~~~~~^~~
/usr/include/c++/14/ostream:235:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(float) [with _CharT = char; _Traits = std::char_traits<char>; __ostream_type = std::basic_ostream<char>]'
235 | operator<<(float __f)
| ^~~~~~~~
/usr/include/c++/14/ostream:235:24: note: no known conversion for argument 1 from 'std::vector<int>' to 'float'
235 | operator<<(float __f)
| ~~~~~~^~~
/usr/include/c++/14/ostream:243:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long double) [with _CharT = char; _Traits = std::char_traits<char>; __ost |
s083147942 | p03920 | C++ | // ConsoleApplication9.cpp : アプリケーションのエントリ ポイントを定義します。
//
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>// ConsoleApplication9.cpp : アプリケーションのエントリ ポイントを定義します。
//
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>// ConsoleApplication9.cpp : アプリケーションのエントリ ポイントを定義します。
//
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define p(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
//#define int long long
using namespace std;
int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };
ll gcd(ll x, ll y) {
ll m = max(x, y), n = min(x, y);
if (m%n == 0)return n;
else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
return x / gcd(x, y)*y;
}
ll myPow(ll x, ll n, ll m) {
if (n == 0)
return 1;
if (n % 2 == 0)
return myPow(x * x % m, n / 2, m);
else
return x * myPow(x, n - 1, m) % m;
}
ll pow2(ll a, ll n) {//aのn乗を計算します。
ll x = 1;
while (n > 0) {//全てのbitが捨てられるまで。
if (n & 1) {//1番右のbitが1のとき。
x = x * a;
}
a = a * a;
n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
}
return x;
}
long long nCr(int n, int r) {
if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
long long ans = 1;
int i;
for (i = 1; i <= r; i++) {
ans *= n - r + i;
ans /= i;
}
return ans;
}
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
bool arr[100000100];
vector<ll>sosuu;
void Eratosthenes() {
ll N = 10000010;
int c = 0;
for (int i = 0; i < N; i++) {
arr[i] = 1;
}
for (ll i = 2; i < sqrt(N); i++) {
if (arr[i]) {
for (ll j = 0; i * (j + 2) < N; j++) {
arr[i *(j + 2)] = 0;
}
}
}
for (ll i = 2; i < N; i++) {
if (arr[i]) {
sosuu.pb(i);
//cout << sosuu[c] << " ";
c++;
}
}
//cout << endl;
//cout << c << endl;
}
ll stoL(string s) {
ll n = s.length();
ll ans = 0;
for (int i = 0; i < n; i++) {
ans += pow2(10, n - i-1)*(ll)(s[i]-'0');
}
return ans;
}
vector<int> v;
void dfs(int n, ll S) {
if (S > 0) {
for (int i = n - 1; i >= 0; i--) {
if (i <= S) {
v.pb(i);
dfs(i, S - i);
break;
}
}
}
}
ll sum[10000000];
int main() {
int N; cin >> N;
sum[0] = 0;
FOR(i,1, 10000000) {
sum[i] = sum[i-1] + i;
}
int n = 0;
REP(i, N+1) {
if (sum[i] >= N) {
v.pb(i);
n = i;
break;
}
}
dfs(n, N - v[0]);
VSORT(v);
for (auto x : v) {
p(x);
}
}
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define p(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
//#define int long long
using namespace std;
int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };
ll gcd(ll x, ll y) {
ll m = max(x, y), n = min(x, y);
if (m%n == 0)return n;
else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
return x / gcd(x, y)*y;
}
ll myPow(ll x, ll n, ll m) {
if (n == 0)
return 1;
if (n % 2 == 0)
return myPow(x * x % m, n / 2, m);
else
return x * myPow(x, n - 1, m) % m;
}
ll pow2(ll a, ll n) {//aのn乗を計算します。
ll x = 1;
while (n > 0) {//全てのbitが捨てられるまで。
if (n & 1) {//1番右のbitが1のとき。
x = x * a;
}
a = a * a;
n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
}
return x;
}
long long nCr(int n, int r) {
if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
long long ans = 1;
int i;
for (i = 1; i <= r; i++) {
ans *= n - r + i;
ans /= i;
}
return ans;
}
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
bool arr[100000100];
vector<ll>sosuu;
void Eratosthenes() {
ll N = 10000010;
int c = 0;
for (int i = 0; i < N; i++) {
arr[i] = 1;
}
for (ll i = 2; i < sqrt(N); i++) {
if (arr[i]) {
for (ll j = 0; i * (j + 2) < N; j++) {
arr[i *(j + 2)] = 0;
}
}
}
for (ll i = 2; i < N; i++) {
if (arr[i]) {
sosuu.pb(i);
//cout << sosuu[c] << " ";
c++;
}
}
//cout << endl;
//cout << c << endl;
}
ll stoL(string s) {
ll n = s.length();
ll ans = 0;
for (int i = 0; i < n; i++) {
ans += pow2(10, n - i-1)*(ll)(s[i]-'0');
}
return ans;
}
vector<int> v;
void dfs(int n, ll S) {
if (S > 0) {
for (int i = n - 1; i >= 0; i--) {
if (i <= S) {
v.pb(i);
dfs(i, S - i);
break;
}
}
}
}
ll sum[10000000];
int main() {
int N; cin >> N;
sum[0] = 0;
FOR(i,1, 10000000) {
sum[i] = sum[i-1] + i;
}
int n = 0;
REP(i, N+1) {
if (sum[i] >= N) {
v.pb(i);
n = i;
break;
}
}
dfs(n, N - v[0]);
VSORT(v);
for (auto x : v) {
p(x);
}
}
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define p(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
//#define int long long
using namespace std;
int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };
ll gcd(ll x, ll y) {
ll m = max(x, y), n = min(x, y);
if (m%n == 0)return n;
else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
return x / gcd(x, y)*y;
}
ll myPow(ll x, ll n, ll m) {
if (n == 0)
return 1;
if (n % 2 == 0)
return myPow(x * x % m, n / 2, m);
else
return x * myPow(x, n - 1, m) % m;
}
ll pow2(ll a, ll n) {//aのn乗を計算します。
ll x = 1;
while (n > 0) {//全てのbitが捨てられるまで。
if (n & 1) {//1番右のbitが1のとき。
x = x * a;
}
a = a * a;
n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
}
return x;
}
long long nCr(int n, int r) {
if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
long long ans = 1;
int i;
for (i = 1; i <= r; i++) {
ans *= n - r + i;
ans /= i;
}
return ans;
}
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
bool arr[100000100];
vector<ll>sosuu;
void Eratosthenes() {
ll N = 10000010;
int c = 0;
for (int i = 0; i < N; i++) {
arr[i] = 1;
}
for (ll i = 2; i < sqrt(N); i++) {
if (arr[i]) {
for (ll j = 0; i * (j + 2) < N; j++) {
arr[i *(j + 2)] = 0;
}
}
}
for (ll i = 2; i < N; i++) {
if (arr[i]) {
sosuu.pb(i);
//cout << sosuu[c] << " ";
c++;
}
}
//cout << endl;
//cout << c << endl;
}
ll stoL(string s) {
ll n = s.length();
ll ans = 0;
for (int i = 0; i < n; i++) {
ans += pow2(10, n - i-1)*(ll)(s[i]-'0');
}
return ans;
}
vector<int> v;
void dfs(int n, ll S) {
if (S > 0) {
for (int i = n - 1; i >= 0; i--) {
if (i <= S) {
v.pb(i);
dfs(i - 1, S - i);
break;
}
}
}
}
ll sum[10000000];
int main() {
int N; cin >> N;
sum[0] = 0;
FOR(i,1, 10000000) {
sum[i] = sum[i-1] + i;
}
int n = 0;
REP(i, N+1) {
if (sum[i] >= N) {
v.pb(i);
n = i;
break;
}
}
dfs(n, N - v[0]);
VSORT(v);
for (auto x : v) {
p(x);
}
}
| a.cc:238:5: error: redefinition of 'int dy [4]'
238 | int dy[4] = { 0,0,1,-1 };
| ^~
a.cc:59:5: note: 'int dy [4]' previously defined here
59 | int dy[4] = { 0,0,1,-1 };
| ^~
a.cc:239:5: error: redefinition of 'int dx [4]'
239 | int dx[4] = { 1,-1,0,0 };
| ^~
a.cc:60:5: note: 'int dx [4]' previously defined here
60 | int dx[4] = { 1,-1,0,0 };
| ^~
a.cc:240:5: error: redefinition of 'int dxx [8]'
240 | int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
| ^~~
a.cc:61:5: note: 'int dxx [8]' previously defined here
61 | int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
| ^~~
a.cc:241:5: error: redefinition of 'int dyy [8]'
241 | int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };
| ^~~
a.cc:62:5: note: 'int dyy [8]' previously defined here
62 | int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };
| ^~~
a.cc:246:4: error: redefinition of 'long long int gcd(long long int, long long int)'
246 | ll gcd(ll x, ll y) {
| ^~~
a.cc:67:4: note: 'long long int gcd(long long int, long long int)' previously defined here
67 | ll gcd(ll x, ll y) {
| ^~~
a.cc:251:4: error: redefinition of 'long long int lcm(long long int, long long int)'
251 | ll lcm(ll x, ll y) {
| ^~~
a.cc:72:4: note: 'long long int lcm(long long int, long long int)' previously defined here
72 | ll lcm(ll x, ll y) {
| ^~~
a.cc:255:4: error: redefinition of 'long long int myPow(long long int, long long int, long long int)'
255 | ll myPow(ll x, ll n, ll m) {
| ^~~~~
a.cc:76:4: note: 'long long int myPow(long long int, long long int, long long int)' previously defined here
76 | ll myPow(ll x, ll n, ll m) {
| ^~~~~
a.cc:264:4: error: redefinition of 'long long int pow2(long long int, long long int)'
264 | ll pow2(ll a, ll n) {//aのn乗を計算します。
| ^~~~
a.cc:85:4: note: 'long long int pow2(long long int, long long int)' previously defined here
85 | ll pow2(ll a, ll n) {//aのn乗を計算します。
| ^~~~
a.cc:276:11: error: redefinition of 'long long int nCr(int, int)'
276 | long long nCr(int n, int r) {
| ^~~
a.cc:97:11: note: 'long long int nCr(int, int)' previously defined here
97 | long long nCr(int n, int r) {
| ^~~
a.cc:289:11: error: redefinition of 'const int MAX'
289 | const int MAX = 510000;
| ^~~
a.cc:110:11: note: 'const int MAX' previously defined here
110 | const int MAX = 510000;
| ^~~
a.cc:290:11: error: redefinition of 'const int MOD'
290 | const int MOD = 1000000007;
| ^~~
a.cc:111:11: note: 'const int MOD' previously defined here
111 | const int MOD = 1000000007;
| ^~~
a.cc:292:11: error: redefinition of 'long long int fac [510000]'
292 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~
a.cc:113:11: note: 'long long int fac [510000]' previously declared here
113 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~
a.cc:292:21: error: redefinition of 'long long int finv [510000]'
292 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~~
a.cc:113:21: note: 'long long int finv [510000]' previously declared here
113 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~~
a.cc:292:32: error: redefinition of 'long long int inv [510000]'
292 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~
a.cc:113:32: note: 'long long int inv [510000]' previously declared here
113 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~
a.cc:295:6: error: redefinition of 'void COMinit()'
295 | void COMinit() {
| ^~~~~~~
a.cc:116:6: note: 'void COMinit()' previously defined here
116 | void COMinit() {
| ^~~~~~~
a.cc:307:11: error: redefinition of 'long long int COM(int, int)'
307 | long long COM(int n, int k) {
| ^~~
a.cc:128:11: note: 'long long int COM(int, int)' previously defined here
128 | long long COM(int n, int k) {
| ^~~
a.cc:313:6: error: redefinition of 'bool arr [100000100]'
313 | bool arr[100000100];
| ^~~
a.cc:134:6: note: 'bool arr [100000100]' previously declared here
134 | bool arr[100000100];
| ^~~
a.cc:314:11: error: redefinition of 'std::vector<long long int> sosuu'
314 | vector<ll>sosuu;
| ^~~~~
a.cc:135:11: note: 'std::vector<long long int> sosuu' previously declared here
135 | vector<ll>sosuu;
| ^~~~~
a.cc:315:6: error: redefinition of 'void Eratosthenes()'
315 | void Eratosthenes() {
| ^~~~~~~~~~~~
a.cc:136:6: note: 'void Eratosthenes()' previously defined here
136 | void Eratosthenes() {
| ^~~~~~~~~~~~
a.cc:340:4: error: redefinition of 'long long int stoL(std::string)'
340 | ll stoL(string s) {
| ^~~~
a.cc:161:4: note: 'long long int stoL(std::string)' previously defined here
161 | ll stoL(string s) {
| ^~~~
a.cc:349:13: error: redefinition of 'std::vector<int> v'
349 | vector<int> v;
| ^
a.cc:170:13: note: 'std::vector<int> v' previously declared here
170 | vector<int> v;
| ^
a.cc:350:6: error: redefinition of 'void dfs(int, long long int)'
350 | void dfs(int n, ll S) {
| ^~~
a.cc:171:6: note: 'void dfs(int, long long int)' previously defined here
171 | void dfs(int n, ll S) {
| ^~~
a.cc:361:4: error: redefinition of 'long long int sum [10000000]'
361 | ll sum[10000000];
| ^~~
a.cc:182:4: note: 'long long int sum [10000000]' previously declared here
182 | ll sum[10000000];
| ^~~
a.cc:362:5: error: redefinition of 'int main()'
362 | int main() {
| ^~~~
a.cc:183:5: note: 'int main()' previously defined here
183 | int main() {
| ^~~~
a.cc:416:5: error: redefinition of 'int dy [4]'
416 | int dy[4] = { 0,0,1,-1 };
| ^~
a.cc:59:5: note: 'int dy [4]' previously defined here
59 | int dy[4] = { 0,0,1,-1 };
| ^~
a.cc:417:5: error: redefinition of 'int dx [4]'
417 | int dx[4] = { 1,-1,0,0 };
| ^~
a.cc:60:5: note: 'int dx [4]' previously defined here
60 | int dx[4] = { 1,-1,0,0 };
| ^~
a.cc:418:5: error: redefinition of 'int dxx [8]'
418 | int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
| ^~~
a.cc:61:5: note: 'int dxx [8]' previously defined here
61 | int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
| ^~~
a.cc:419:5: error: redefinition of 'int dyy [8]'
419 | int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };
| ^~~
a.cc:62:5: note: 'int dyy [8]' previously defined here
62 | int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };
| ^~~
a.cc:424:4: error: redefinition of 'long long int gcd(long long int, long long int)'
424 | ll gcd(ll x, ll y) {
| ^~~
a.cc:67:4: note: 'long long int gcd(long long int, long long int)' previously defined here
67 | ll gcd(ll x, ll y) {
| ^~~
a.cc:429:4: error: redefinition of 'long long int lcm(long long int, long long int)'
429 | ll lcm(ll x, ll y) {
| ^~~
a.cc:72:4: note: 'long long int lcm(long long int, long long int)' previously defined here
72 | ll lcm(ll x, ll y) {
| ^~~
a.cc:433:4: error: redefinition of 'long long int myPow(long long int, long long int, long long int)'
433 | ll myPow(ll x, ll n, ll m) {
| ^~~~~
a.cc:76:4: note: 'long long int myPow(long long int, long long int, long long int)' previously defined here
76 | ll myPow(ll x, ll n, ll m) {
| ^~~~~
a.cc:442:4: error: redefinition of 'long long int pow2(long long int, long long int)'
442 | ll pow2(ll a, ll n) {//aのn乗を計算します。
| ^~~~
a.cc:85:4: note: 'long long int pow2(long long int, long long int)' previously defined here
85 | ll pow2(ll a, ll n) {//aのn乗を計算します。
| ^~~~
a.cc:454:11: error: redefinition of 'long long int nCr(int, int)'
454 | long long nCr(int n, int r) {
| ^~~
a.cc:97:11: note: 'long long int nCr(int, int)' previously defined here
97 | long long nCr(int n, int r) {
| ^~~
a.cc:467:11: error: redefinition of 'const int MAX'
467 | const int MAX = 510000;
| ^~~
a.cc:110:11: note: 'const int MAX' previously defined here
110 | const int MAX = 510000;
| ^~~
a.cc:468:11: error: redefinition of 'const int MOD'
468 | const int MOD = 1000000007;
| ^~~
a.cc:111:11: note: 'const int MOD' previously defined here
111 | const int MOD = 1000000007;
| ^~~
a.cc:470:11: error: redefinition of 'long long int fac [510000]'
470 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~
a.cc:113:11: note: 'long long int fac [510000]' previously declared here
113 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~
a.cc:470:21: error: redefinition of 'long long int finv [510000]'
470 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~~
a.cc:113:21: note: 'long long int finv [510000]' previously declared here
113 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~~
a.cc:470:32: error: redefinition of 'long long int inv [510000]'
470 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~
a.cc:113:32: note: 'long long int inv [510000]' previously declared here
113 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~
a.cc:473:6: error: redefinition of 'void COMinit()'
473 | void COMinit() {
| ^~~~~~~
a.cc:116:6: note: 'void COMinit()' previously defined here
116 | void COMinit() {
| ^~~~~~~
a.cc:485:11: error: redefinition of 'long long int COM(int, int)'
485 | long long COM(int n, int k) {
| ^~~
a.cc:128:11: note: 'long long int COM(int, int)' previously defined here
128 | long long COM(int n, int k) {
| ^~~
a.cc:491:6: error: redefinition of 'bool arr [100000100]'
491 | bool arr[100000100];
| ^~~
a.cc:134:6: note: 'bool arr [100000100]' previously declared here
134 | bool arr[100000100];
| ^~~
a.cc:492:11: error: redefinition of 'std: |
s846418980 | p03920 | C++ | // ConsoleApplication9.cpp : アプリケーションのエントリ ポイントを定義します。
//
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>// ConsoleApplication9.cpp : アプリケーションのエントリ ポイントを定義します。
//
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define p(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
//#define int long long
using namespace std;
int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };
ll gcd(ll x, ll y) {
ll m = max(x, y), n = min(x, y);
if (m%n == 0)return n;
else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
return x / gcd(x, y)*y;
}
ll myPow(ll x, ll n, ll m) {
if (n == 0)
return 1;
if (n % 2 == 0)
return myPow(x * x % m, n / 2, m);
else
return x * myPow(x, n - 1, m) % m;
}
ll pow2(ll a, ll n) {//aのn乗を計算します。
ll x = 1;
while (n > 0) {//全てのbitが捨てられるまで。
if (n & 1) {//1番右のbitが1のとき。
x = x * a;
}
a = a * a;
n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
}
return x;
}
long long nCr(int n, int r) {
if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
long long ans = 1;
int i;
for (i = 1; i <= r; i++) {
ans *= n - r + i;
ans /= i;
}
return ans;
}
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
bool arr[100000100];
vector<ll>sosuu;
void Eratosthenes() {
ll N = 10000010;
int c = 0;
for (int i = 0; i < N; i++) {
arr[i] = 1;
}
for (ll i = 2; i < sqrt(N); i++) {
if (arr[i]) {
for (ll j = 0; i * (j + 2) < N; j++) {
arr[i *(j + 2)] = 0;
}
}
}
for (ll i = 2; i < N; i++) {
if (arr[i]) {
sosuu.pb(i);
//cout << sosuu[c] << " ";
c++;
}
}
//cout << endl;
//cout << c << endl;
}
ll stoL(string s) {
ll n = s.length();
ll ans = 0;
for (int i = 0; i < n; i++) {
ans += pow2(10, n - i-1)*(ll)(s[i]-'0');
}
return ans;
}
vector<int> v;
void dfs(int n, ll S) {
if (S > 0) {
for (int i = n - 1; i >= 0; i--) {
if (i <= S) {
v.pb(i);
dfs(i, S - i);
break;
}
}
}
}
ll sum[10000000];
int main() {
int N; cin >> N;
sum[0] = 0;
FOR(i,1, 10000000) {
sum[i] = sum[i-1] + i;
}
int n = 0;
REP(i, N+1) {
if (sum[i] >= N) {
v.pb(i);
n = i;
break;
}
}
dfs(n, N - v[0]);
VSORT(v);
for (auto x : v) {
p(x);
}
}
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define p(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
//#define int long long
using namespace std;
int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };
ll gcd(ll x, ll y) {
ll m = max(x, y), n = min(x, y);
if (m%n == 0)return n;
else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
return x / gcd(x, y)*y;
}
ll myPow(ll x, ll n, ll m) {
if (n == 0)
return 1;
if (n % 2 == 0)
return myPow(x * x % m, n / 2, m);
else
return x * myPow(x, n - 1, m) % m;
}
ll pow2(ll a, ll n) {//aのn乗を計算します。
ll x = 1;
while (n > 0) {//全てのbitが捨てられるまで。
if (n & 1) {//1番右のbitが1のとき。
x = x * a;
}
a = a * a;
n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
}
return x;
}
long long nCr(int n, int r) {
if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
long long ans = 1;
int i;
for (i = 1; i <= r; i++) {
ans *= n - r + i;
ans /= i;
}
return ans;
}
const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
fac[0] = fac[1] = 1;
finv[0] = finv[1] = 1;
inv[1] = 1;
for (int i = 2; i < MAX; i++) {
fac[i] = fac[i - 1] * i % MOD;
inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
finv[i] = finv[i - 1] * inv[i] % MOD;
}
}
// 二項係数計算
long long COM(int n, int k) {
if (n < k) return 0;
if (n < 0 || k < 0) return 0;
return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
bool arr[100000100];
vector<ll>sosuu;
void Eratosthenes() {
ll N = 10000010;
int c = 0;
for (int i = 0; i < N; i++) {
arr[i] = 1;
}
for (ll i = 2; i < sqrt(N); i++) {
if (arr[i]) {
for (ll j = 0; i * (j + 2) < N; j++) {
arr[i *(j + 2)] = 0;
}
}
}
for (ll i = 2; i < N; i++) {
if (arr[i]) {
sosuu.pb(i);
//cout << sosuu[c] << " ";
c++;
}
}
//cout << endl;
//cout << c << endl;
}
ll stoL(string s) {
ll n = s.length();
ll ans = 0;
for (int i = 0; i < n; i++) {
ans += pow2(10, n - i-1)*(ll)(s[i]-'0');
}
return ans;
}
vector<int> v;
void dfs(int n, ll S) {
if (S > 0) {
for (int i = n - 1; i >= 0; i--) {
if (i <= S) {
v.pb(i);
dfs(i - 1, S - i);
break;
}
}
}
}
ll sum[10000000];
int main() {
int N; cin >> N;
sum[0] = 0;
FOR(i,1, 10000000) {
sum[i] = sum[i-1] + i;
}
int n = 0;
REP(i, N+1) {
if (sum[i] >= N) {
v.pb(i);
n = i;
break;
}
}
dfs(n, N - v[0]);
VSORT(v);
for (auto x : v) {
p(x);
}
}
| a.cc:229:5: error: redefinition of 'int dy [4]'
229 | int dy[4] = { 0,0,1,-1 };
| ^~
a.cc:51:5: note: 'int dy [4]' previously defined here
51 | int dy[4] = { 0,0,1,-1 };
| ^~
a.cc:230:5: error: redefinition of 'int dx [4]'
230 | int dx[4] = { 1,-1,0,0 };
| ^~
a.cc:52:5: note: 'int dx [4]' previously defined here
52 | int dx[4] = { 1,-1,0,0 };
| ^~
a.cc:231:5: error: redefinition of 'int dxx [8]'
231 | int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
| ^~~
a.cc:53:5: note: 'int dxx [8]' previously defined here
53 | int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
| ^~~
a.cc:232:5: error: redefinition of 'int dyy [8]'
232 | int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };
| ^~~
a.cc:54:5: note: 'int dyy [8]' previously defined here
54 | int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };
| ^~~
a.cc:237:4: error: redefinition of 'long long int gcd(long long int, long long int)'
237 | ll gcd(ll x, ll y) {
| ^~~
a.cc:59:4: note: 'long long int gcd(long long int, long long int)' previously defined here
59 | ll gcd(ll x, ll y) {
| ^~~
a.cc:242:4: error: redefinition of 'long long int lcm(long long int, long long int)'
242 | ll lcm(ll x, ll y) {
| ^~~
a.cc:64:4: note: 'long long int lcm(long long int, long long int)' previously defined here
64 | ll lcm(ll x, ll y) {
| ^~~
a.cc:246:4: error: redefinition of 'long long int myPow(long long int, long long int, long long int)'
246 | ll myPow(ll x, ll n, ll m) {
| ^~~~~
a.cc:68:4: note: 'long long int myPow(long long int, long long int, long long int)' previously defined here
68 | ll myPow(ll x, ll n, ll m) {
| ^~~~~
a.cc:255:4: error: redefinition of 'long long int pow2(long long int, long long int)'
255 | ll pow2(ll a, ll n) {//aのn乗を計算します。
| ^~~~
a.cc:77:4: note: 'long long int pow2(long long int, long long int)' previously defined here
77 | ll pow2(ll a, ll n) {//aのn乗を計算します。
| ^~~~
a.cc:267:11: error: redefinition of 'long long int nCr(int, int)'
267 | long long nCr(int n, int r) {
| ^~~
a.cc:89:11: note: 'long long int nCr(int, int)' previously defined here
89 | long long nCr(int n, int r) {
| ^~~
a.cc:280:11: error: redefinition of 'const int MAX'
280 | const int MAX = 510000;
| ^~~
a.cc:102:11: note: 'const int MAX' previously defined here
102 | const int MAX = 510000;
| ^~~
a.cc:281:11: error: redefinition of 'const int MOD'
281 | const int MOD = 1000000007;
| ^~~
a.cc:103:11: note: 'const int MOD' previously defined here
103 | const int MOD = 1000000007;
| ^~~
a.cc:283:11: error: redefinition of 'long long int fac [510000]'
283 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~
a.cc:105:11: note: 'long long int fac [510000]' previously declared here
105 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~
a.cc:283:21: error: redefinition of 'long long int finv [510000]'
283 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~~
a.cc:105:21: note: 'long long int finv [510000]' previously declared here
105 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~~
a.cc:283:32: error: redefinition of 'long long int inv [510000]'
283 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~
a.cc:105:32: note: 'long long int inv [510000]' previously declared here
105 | long long fac[MAX], finv[MAX], inv[MAX];
| ^~~
a.cc:286:6: error: redefinition of 'void COMinit()'
286 | void COMinit() {
| ^~~~~~~
a.cc:108:6: note: 'void COMinit()' previously defined here
108 | void COMinit() {
| ^~~~~~~
a.cc:298:11: error: redefinition of 'long long int COM(int, int)'
298 | long long COM(int n, int k) {
| ^~~
a.cc:120:11: note: 'long long int COM(int, int)' previously defined here
120 | long long COM(int n, int k) {
| ^~~
a.cc:304:6: error: redefinition of 'bool arr [100000100]'
304 | bool arr[100000100];
| ^~~
a.cc:126:6: note: 'bool arr [100000100]' previously declared here
126 | bool arr[100000100];
| ^~~
a.cc:305:11: error: redefinition of 'std::vector<long long int> sosuu'
305 | vector<ll>sosuu;
| ^~~~~
a.cc:127:11: note: 'std::vector<long long int> sosuu' previously declared here
127 | vector<ll>sosuu;
| ^~~~~
a.cc:306:6: error: redefinition of 'void Eratosthenes()'
306 | void Eratosthenes() {
| ^~~~~~~~~~~~
a.cc:128:6: note: 'void Eratosthenes()' previously defined here
128 | void Eratosthenes() {
| ^~~~~~~~~~~~
a.cc:331:4: error: redefinition of 'long long int stoL(std::string)'
331 | ll stoL(string s) {
| ^~~~
a.cc:153:4: note: 'long long int stoL(std::string)' previously defined here
153 | ll stoL(string s) {
| ^~~~
a.cc:340:13: error: redefinition of 'std::vector<int> v'
340 | vector<int> v;
| ^
a.cc:162:13: note: 'std::vector<int> v' previously declared here
162 | vector<int> v;
| ^
a.cc:341:6: error: redefinition of 'void dfs(int, long long int)'
341 | void dfs(int n, ll S) {
| ^~~
a.cc:163:6: note: 'void dfs(int, long long int)' previously defined here
163 | void dfs(int n, ll S) {
| ^~~
a.cc:352:4: error: redefinition of 'long long int sum [10000000]'
352 | ll sum[10000000];
| ^~~
a.cc:174:4: note: 'long long int sum [10000000]' previously declared here
174 | ll sum[10000000];
| ^~~
a.cc:353:5: error: redefinition of 'int main()'
353 | int main() {
| ^~~~
a.cc:175:5: note: 'int main()' previously defined here
175 | int main() {
| ^~~~
|
s180472416 | p03920 | C++ | #include <bits/stdc++.h>
using namespace std;
bool isOK(int ma, int n) {
for (int i = ma; i >= 1; --i) {
if (n >= i) {
n -= i;
}
}
return n == 0;
}
int main() {
int n;
cin >> n;
int left = 0, right = n;
int ma = n;
while (right - left > 1) {
int mid = left + (right - left) / 2;
if (isOK(mid, n))
right = mid;
ma = mid;
else left = mid;
}
for (int i = ma; i >= 1; --i) {
if (n >= i) {
n -= i;
cout << i << endl;
}
}
} | a.cc: In function 'int main()':
a.cc:24:5: error: 'else' without a previous 'if'
24 | else left = mid;
| ^~~~
|
s280994095 | p03920 | C++ | def getN():
return int(input())
def getNM():
return map(int, input().split())
def getList():
return list(map(int, input().split()))
N = getN()
for i in range(10**4):
if i*(i+1)/2 >= N:
M = i
upper =int(M*(M+1)/2)
break
diff = upper-N
for i in range(M):
j = i+1
if j is not diff:
print(j)
| a.cc:1:1: error: 'def' does not name a type
1 | def getN():
| ^~~
|
s191342043 | p03920 | C++ | #include<cstdio>
int main(void){
int n;
int s=0;
scanf("%d",&n);
for(int i=1;i<n;i++){
if(n-s>2*i){
printf("%d\n",i);
s=s+i;
}
else if(n-s==i){
printf("%d"\n,i);
s=s+i;
}
}
return 0;
} | a.cc:12:12: error: stray '\' in program
12 | printf("%d"\n,i);
| ^
a.cc: In function 'int main()':
a.cc:12:12: error: expected ')' before 'n'
12 | printf("%d"\n,i);
| ~ ^~
| )
|
s439142040 | p03920 | C++ | #include <iostream>
#include <vector>
using namespace std;
int main() {
int N, i = 1, j;
vector<long long> NN;
cin >> N;
while (N >= 0) {
NN.push_back(i);
N -= i;
//cout << i << endl;
i++;
}
for (j = 0; j < i - 1; j++) {
if (NN[j] != N*-1) {
cout << NN[j] << endl;
}
}
return 0; | a.cc: In function 'int main()':
a.cc:22:18: error: expected '}' at end of input
22 | return 0;
| ^
a.cc:5:12: note: to match this '{'
5 | int main() {
| ^
|
s601251133 | p03920 | C++ | #include <iostream>
#include <string>
#include <cstdio>
#include <string>
#include <cstring>
#define rep(i, n) REP(i, 0, n)
#define REP(i, a, n) for(int i = a ; i < (int)n ; i++)
typedef long long ll;
using namespace std;
int N;
int n=1;
bool memo[2001][2001];
bool visited[2001][2001];
bool solve(int i, int sum){
// すでに来てる
if(visited[i][sum]) return memo[i][sum];
visited[i][sum] = true;
if(i > n) return false;
// 組み合わせができた
if(i+sum == N){
printf("%d\n", i);
return memo[i][sum]=visited[i][sum] = true;
}
// 足す
if(solve(i+1, sum+i)){
printf("%d\n", i);
return memo[i][sum] = true;
}
// 足さない
if(solve(i+1, sum)){
return memo[i][sum] = true;
}
return false;
}
signed main(){
scanf("%d", &N);
vector<int> v;
while(0.5*n*(n+1) <= N) n++;
fill(memo[0], memo[2000], false);
fill(visited[0], visited[2000], false);
solve(1, 0);
}
| a.cc: In function 'int main()':
a.cc:50:3: error: 'vector' was not declared in this scope
50 | vector<int> v;
| ^~~~~~
a.cc:6:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
5 | #include <cstring>
+++ |+#include <vector>
6 |
a.cc:50:10: error: expected primary-expression before 'int'
50 | vector<int> v;
| ^~~
|
s788935051 | p03920 | C++ | #include<iostream>
#include<string>
#include<vector>
using namespace std;
int max = INT_MAX;
vector<vector<int>> n;
bool finding = false;
int max1 = INT_MAX;
int calcPattern(long long sum, vector<int> pattern, int nextNumber,int just) {
long long temp = sum;
vector<int> tempPattern = pattern;
sum += nextNumber;
if (nextNumber > max1)return 0;
if (nextNumber >= max)return 0;
if (sum == just/* && !finding*/) {
pattern.push_back(nextNumber);
if (nextNumber > max1)return 0;
max1 = nextNumber;
n.push_back(pattern);
finding = true;
return 1;
}
else if (sum > just) {
return 0;
}
else {
pattern.push_back(nextNumber);
nextNumber++;
return calcPattern(sum, pattern, nextNumber, just)+ calcPattern(temp, tempPattern, nextNumber, just);
}
}
int main() {
int N, check;
vector<int> pattern;
cin >> N;
if (N >= 8)max = (N + 1) / 2;
check = calcPattern(0, pattern, 1, N);
int min = INT_MAX, select;
for (unsigned i = 0; i < n.size(); i++) {
if (n[i][n[i].size() - 1] < min) {
min = n[i][n[i].size() - 1];
select = i;
}
}
for (unsigned i = 0; i < n[select].size(); i++) {
cout << n[select][i] << endl;
}
return 0;
} | a.cc:6:11: error: 'INT_MAX' was not declared in this scope
6 | int max = INT_MAX;
| ^~~~~~~
a.cc:4:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
3 | #include<vector>
+++ |+#include <climits>
4 | using namespace std;
a.cc:9:12: error: 'INT_MAX' was not declared in this scope
9 | int max1 = INT_MAX;
| ^~~~~~~
a.cc:9:12: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc: In function 'int calcPattern(long long int, std::vector<int>, int, int)':
a.cc:16:27: error: reference to 'max' is ambiguous
16 | if (nextNumber >= max)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:303:5: note: candidates are: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:6:5: note: 'int max'
6 | int max = INT_MAX;
| ^~~
a.cc: In function 'int main()':
a.cc:40:20: error: reference to 'max' is ambiguous
40 | if (N >= 8)max = (N + 1) / 2;
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidates are: '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:257:5: note: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
257 | max(const _Tp& __a, const _Tp& __b)
| ^~~
a.cc:6:5: note: 'int max'
6 | int max = INT_MAX;
| ^~~
a.cc:42:19: error: 'INT_MAX' was not declared in this scope
42 | int min = INT_MAX, select;
| ^~~~~~~
a.cc:42:19: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:46:32: error: assignment of function 'int select(int, fd_set*, fd_set*, fd_set*, timeval*)'
46 | select = i;
| ~~~~~~~^~~
a.cc:49:36: error: invalid conversion from 'int (*)(int, fd_set*, fd_set*, fd_set*, timeval*)' to 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-fpermissive]
49 | for (unsigned i = 0; i < n[select].size(); i++) {
| ^~~~~~
| |
| int (*)(int, fd_set*, fd_set*, fd_set*, timeval*)
In file included from /usr/include/c++/14/vector:66,
from a.cc:3:
/usr/include/c++/14/bits/stl_vector.h:1128:28: note: initializing argument 1 of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; reference = std::vector<int>&; size_type = long unsigned int]'
1128 | operator[](size_type __n) _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~^~~
a.cc:50:27: error: invalid conversion from 'int (*)(int, fd_set*, fd_set*, fd_set*, timeval*)' to 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-fpermissive]
50 | cout << n[select][i] << endl;
| ^~~~~~
| |
| int (*)(int, fd_set*, fd_set*, fd_set*, timeval*)
/usr/include/c++/14/bits/stl_vector.h:1128:28: note: initializing argument 1 of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; reference = std::vector<int>&; size_type = long unsigned int]'
1128 | operator[](size_type __n) _GLIBCXX_NOEXCEPT
| ~~~~~~~~~~^~~
|
s815850113 | p03920 | C++ | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
namespace Program
{
using namespace std;
class Solver
{
private:
int N;
vector<int> v;
bool flg = false;
public:
Solver()
{
cin.tie(0);
ios::sync_with_stdio(false);
cin >> N;
}
void Solve()
{
v.resize(N);
f(1, 0, 0);
// return 0;
}
void f(int start, int sum, int num)
/* start - 次のは start 以降から選ぶ */
/* sum - 今までの合計は sum */
/* num - 今までに num 個選んだ */
{
int i;
/* 見つかった */
int tmp = 0;
if (sum == N) {
for (i = 0; i < v.size(); i++)
{
cout << v[i] << "\n";
tmp += v[i];
if (tmp == N)
{
flg = true;
break;
}
}
return;
}
/* おおきすぎた */
if (sum > N) return;
/* まだ足りないから、つぎのを選ぶ */
for (i = start; i <= N; i++) {
v[num] = i;
f(i + 1, sum + v[num], num + 1);
if (flg) return;
}
return;
}
};
}
int main()
{
// メモリリーク検出
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF
| _CRTDBG_DELAY_FREE_MEM_DF
| _CRTDBG_CHECK_ALWAYS_DF
| _CRTDBG_LEAK_CHECK_DF);
// メンバ関数ポインタ取得
void (Program::Solver::*pSolve)() = &Program::Solver::Solve;
// コンストラクタ呼び出し
Program::Solver obj;
// .*演算子でアクセス
(obj.*pSolve)();
return 0;
}
| a.cc: In function 'int main()':
a.cc:69:20: error: '_CRTDBG_ALLOC_MEM_DF' was not declared in this scope
69 | _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF
| ^~~~~~~~~~~~~~~~~~~~
a.cc:70:11: error: '_CRTDBG_DELAY_FREE_MEM_DF' was not declared in this scope
70 | | _CRTDBG_DELAY_FREE_MEM_DF
| ^~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:71:11: error: '_CRTDBG_CHECK_ALWAYS_DF' was not declared in this scope
71 | | _CRTDBG_CHECK_ALWAYS_DF
| ^~~~~~~~~~~~~~~~~~~~~~~
a.cc:72:11: error: '_CRTDBG_LEAK_CHECK_DF' was not declared in this scope
72 | | _CRTDBG_LEAK_CHECK_DF);
| ^~~~~~~~~~~~~~~~~~~~~
a.cc:69:5: error: '_CrtSetDbgFlag' was not declared in this scope
69 | _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF
| ^~~~~~~~~~~~~~
|
s887756366 | p03921 | C++ | #include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;}
// 二次元ベクターの基本
/*
vector<vector<int>> dp; // 宣言
dp.resize(n); // 1次元めの要素数決定
dp[i].push_back(int); // プッシュバック
rep(i,n){
sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
}
*/
// 整数スキャン(複数)
/*
int x,y,z;
scanf("%d%d%d",&x,&y,&z);
// n個の整数のスキャン
/*
ll a[n] = {};
rep(i,n){
scanf("%lld",&a[i]);
}
*/
// 文字列スキャン
/*
string s; cin >> s;
*/
// n個の文字列スキャン
/*
vector<string> slist;
rep(i,n){
string s; cin >> s;
slist.push_back(s);
}
*/
// n要素で初期化
void init(int par[], int rank[], int n){
for(int i=0;i<n;i++){
par[i] = i;
rank[i] = 0;
}
}
// 木の根を求める
int find(int par[], int x){
if(par[x] == x){
return x;
}else{
return par[x] = find(par,par[x]);
}
}
// xとyの属する集合を併合
void unite(int par[], int rank[], int x, int y){
x = find(par,x);
y = find(par,y);
if(x == y) return;
if(rank[x] < rank[y]){
par[x] = y;
}else{
par[y] = x;
if(rank[x] == rank[y]) rank[x]++;
}
}
// xとyが同じ集合に属するか否か
bool same(int par[], int x, int y){
return find(par,x) == find(par,y);
}
int main() {
int n,m;
cin >> n >> m;
int par[m+1];
int rank[m+1];
init(par,rank,m+1);
int flag[m+1] = {};
rep(i,n){
int k;
cin >> k;
int l[k];
rep(j,k){
cin >> l[j];
flag[l[j]] = 1;
if(j>=1){
unite(par,rank,l[j],l[j-1]);
}
}
}
int f = 0;
int x = 0;
rep(i,m+1){
if(f==0){
if(flag[i]==1){
f = 1;
x = find(par,i);
}
}else{
if(flag==1){
if(find(par,i)!=x){
cout << "NO" << endl;
return 0;
}
}
}
}
cout << "YES" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:157:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
157 | if(flag==1){
| ~~~~^~~
|
s603047859 | p03921 | C++ | #include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;}
// 二次元ベクターの基本
/*
vector<vector<int>> dp; // 宣言
dp.resize(n); // 1次元めの要素数決定
dp[i].push_back(int); // プッシュバック
rep(i,n){
sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
}
*/
// 整数スキャン(複数)
/*
int x,y,z;
scanf("%d%d%d",&x,&y,&z);
// n個の整数のスキャン
/*
ll a[n] = {};
rep(i,n){
scanf("%lld",&a[i]);
}
*/
// 文字列スキャン
/*
string s; cin >> s;
*/
// n個の文字列スキャン
/*
vector<string> slist;
rep(i,n){
string s; cin >> s;
slist.push_back(s);
}
*/
// n要素で初期化
void init(int par[], int rank[], int n){
for(int i=0;i<n;i++){
par[i] = i;
rank[i] = 0;
}
}
// 木の根を求める
int find(int par[], int x){
if(par[x] == x){
return x;
}else{
return par[x] = find(par,par[x]);
}
}
// xとyの属する集合を併合
void unite(int par[], int rank[], int x, int y){
x = find(par,x);
y = find(par,y);
if(x == y) return;
if(rank[x] < rank[y]){
par[x] = y;
}else{
par[y] = x;
if(rank[x] == rank[y]) rank[x]++;
}
}
// xとyが同じ集合に属するか否か
bool same(int par[], int x, int y){
return find(par,x) == find(par,y);
}
int main() {
int n,m;
cin >> n >> m;
int par[m+1];
int rank[m+1];
init(par,rank,m+1);
int flag[m+1] = {};
rep(i,n){
int k;
cin >> k;
int l[k];
rep(j,k){
cin >> l[j];
flag[l[j]] = 1;
if(j=>1){
unite(par,rank,l[j],l[j-1]);
}
}
}
int f = 0;
int x = 0;
rep(i,m+1){
if(f==0){
if(flag[i]==1){
f = 1;
x = find(par,i);
}
}else{
if(flag==1){
if(find(par,i)!=x){
cout << "NO" << endl;
return 0;
}
}
}
}
cout << "YES" << endl;
return 0;
}
| a.cc: In function 'int main()':
a.cc:142:18: error: expected primary-expression before '>' token
142 | if(j=>1){
| ^
a.cc:157:20: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
157 | if(flag==1){
| ~~~~^~~
|
s920880602 | p03921 | C++ | #include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<climits>
#include<set>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
using namespace std;
typedef pair<int, int> pii;
typedef long long int ll;
typedef pair<ll,ll> pll;
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};
#define MOD 1000000007
#define ARRAY_MAX 100005
const int INF = 1e9+7;
vector<int> person[ARRAY_MAX];//人の隣接リスト
vector<int> lang[ARRAY_MAX];//言語の隣接リスト
bool person_used[ARRAY_MAX];//人を使ったかどうか
bool lang_used[ARRAY_MAX];//言語を使ったかどうか
void lang_dfs(int lang_now);
void person_dfs(int person_now);
void person_dfs(int person_now){
//現在見ている言語を話せる人
person_used[person_now] = true;
bool all_used = true;
for(int i = 0;i < n;i++){
all_used &= person_used[i];
}
if(all_used){
return;
}
for(int i = 0;i < person[person_now].size();i++){
if(lang_used[person[person_now][i]] == true){
//既にこの言語は調べられている
continue;
}
lang_dfs(person[person_now][i]);
}
}
void lang_dfs(int lang_now){
//現在見ている人が話せる言語
lang_used[lang_now] = true;
for(int i = 0;i < lang[lang_now].size();i++){
if(person_used[lang[lang_now][i]] == true){
continue;
}
person_dfs(lang[lang_now][i]);
}
}
int main(){
int n,m;
cin >> n >> m;
for(int i = 0;i < n;i++){
int k;
cin >> k;
for(int j = 0;j < k;j++){
int a;
cin >> a;
person[i].push_back(a-1);//人iが話せる言語
lang[a-1].push_back(i);//言語a-1を話せる人の番号
}
}
person_used[0] = true;
person_dfs(lang[0][0]);
/*for(int i = 0;i < m;i++){//言語で潜る
if(lang_used[i] == true){
//既にその言語が調べられているときは調べない
continue;
}
cout << i << endl;
lang_used[i] = true;
for(int j = 0;j < lang[i].size();j++){//言語を話せる人
if(person_used[lang[i][j]] == false){
//まだこの人を調べていない
person_dfs(lang[i][j]);
}
}
}*/
for(int i = 0;i < n;i++){
if(person_used[i] == false){
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
} | a.cc: In function 'void person_dfs(int)':
a.cc:46:23: error: 'n' was not declared in this scope
46 | for(int i = 0;i < n;i++){
| ^
|
s437644768 | p03921 | C++ | #include <iostream>
using namespace std;
const int NMAX = 1e+5;
const int MMAX = 1e+5;
int par[NMAX+MMAX], rank[NMAX+MMAX];
void init(int n)
{
for(int i = 0; i < n; i++){
par[i] = i;
rank[i] = 0;
}
}
int find(int x)
{
if(par[x] == x) return x;
else 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;
}else{
par[y] = x;
if(rank[x] == rank[y]) rank[x]++;
}
}
bool same(int x, int y)
{
return find(x) == find(y);
}
int main()
{
int n, m;
cin >> n >> m;
init(n+m);
for(int i = 0; i < n; i++){
int k;
cin >> k;
for(int j = 0; j < k; j++){
int l;
cin >> l;
unite(i, n+l-1);
}
}
for(int i = 1; i < n; i++){
if(!same(i, i-1)){
cout << "NO" << endl;
return 0;
}
}
cout << "YES" << endl;
return 0;
}
| a.cc: In function 'void init(int)':
a.cc:13:5: error: reference to 'rank' is ambiguous
13 | rank[i] = 0;
| ^~~~
In file included from /usr/include/c++/14/bits/move.h:37,
from /usr/include/c++/14/bits/exception_ptr.h:41,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:7:21: note: 'int rank [200000]'
7 | int par[NMAX+MMAX], rank[NMAX+MMAX];
| ^~~~
a.cc: In function 'void unite(int, int)':
a.cc:29:6: error: reference to 'rank' is ambiguous
29 | if(rank[x] < rank[y]){
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:7:21: note: 'int rank [200000]'
7 | int par[NMAX+MMAX], rank[NMAX+MMAX];
| ^~~~
a.cc:29:16: error: reference to 'rank' is ambiguous
29 | if(rank[x] < rank[y]){
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:7:21: note: 'int rank [200000]'
7 | int par[NMAX+MMAX], rank[NMAX+MMAX];
| ^~~~
a.cc:33:8: error: reference to 'rank' is ambiguous
33 | if(rank[x] == rank[y]) rank[x]++;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:7:21: note: 'int rank [200000]'
7 | int par[NMAX+MMAX], rank[NMAX+MMAX];
| ^~~~
a.cc:33:19: error: reference to 'rank' is ambiguous
33 | if(rank[x] == rank[y]) rank[x]++;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:7:21: note: 'int rank [200000]'
7 | int par[NMAX+MMAX], rank[NMAX+MMAX];
| ^~~~
a.cc:33:28: error: reference to 'rank' is ambiguous
33 | if(rank[x] == rank[y]) rank[x]++;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:7:21: note: 'int rank [200000]'
7 | int par[NMAX+MMAX], rank[NMAX+MMAX];
| ^~~~
|
s379922774 | p03921 | C++ | #include <bits/stdc++.h>
using namespace std;
int64_t point[100000*100000+10][2];
int64_t node;
int64_t a[100000*2+10];
bool visit[100000*2+10];
int64_t s[100000*2+10];
int64_t h,t;
int main()
{
memset(point,0,sizeof(point));
memset(a,0,sizeof(a));
node=0;
int64_t n,m;
cin>>n>>m;
for (int64_t i=1;i<=n;i++)
{
int temp;
cin>>temp;
for (int64_t j=1;j<=temp;j++)
{
int64_t k;
cin>>k;
node++;
int64_t pp=a[i];
node++;
point[node][0]=k+100001;
point[node][1]=pp;
a[i]=node;
node++;
pp=a[k+100001];
point[node][0]=i;
point[node][1]=pp;
a[k+100001]=node;
//int qq=a[i+100001];
}
}
memset(visit,true,sizeof(visit));
h=0;t=1;
s[1]=1;
while (h!=t)
{
h++;
int64_t pp=a[s[h]];
while (pp)
{
if (visit[point[pp][0]])
{
visit[point[pp][0]]=false;
t++;
s[t]=point[pp][0];
}
pp=point[pp][1];
}
}
bool flag=false;
for (int64_t i=1;i<=n;i++)
{
if (visit[i])
{
flag=true;
break;
}
}
if (flag) cout<<"NO"<<endl;
else cout<<"YES"<<endl;
return 0;
}
| a.cc:5:21: warning: integer overflow in expression of type 'int' results in '1410065408' [-Woverflow]
5 | int64_t point[100000*100000+10][2];
| ~~~~~~^~~~~~~
a.cc:5:28: error: size of array 'point' exceeds maximum object size '9223372036854775807'
5 | int64_t point[100000*100000+10][2];
| ~~~~~~~~~~~~~^~~
a.cc: In function 'int main()':
a.cc:42:13: error: reference to 'visit' is ambiguous
42 | memset(visit,true,sizeof(visit));
| ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:80,
from a.cc:1:
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:8:6: note: 'bool visit [200010]'
8 | bool visit[100000*2+10];
| ^~~~~
a.cc:42:31: error: reference to 'visit' is ambiguous
42 | memset(visit,true,sizeof(visit));
| ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:8:6: note: 'bool visit [200010]'
8 | bool visit[100000*2+10];
| ^~~~~
a.cc:52:12: error: reference to 'visit' is ambiguous
52 | if (visit[point[pp][0]])
| ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:8:6: note: 'bool visit [200010]'
8 | bool visit[100000*2+10];
| ^~~~~
a.cc:54:9: error: reference to 'visit' is ambiguous
54 | visit[point[pp][0]]=false;
| ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:8:6: note: 'bool visit [200010]'
8 | bool visit[100000*2+10];
| ^~~~~
a.cc:64:11: error: reference to 'visit' is ambiguous
64 | if (visit[i])
| ^~~~~
/usr/include/c++/14/variant:1855:5: note: candidates are: 'template<class _Visitor, class ... _Variants> constexpr std::__detail::__variant::__visit_result_t<_Visitor, _Variants ...> std::visit(_Visitor&&, _Variants&& ...)'
1855 | visit(_Visitor&& __visitor, _Variants&&... __variants)
| ^~~~~
a.cc:8:6: note: 'bool visit [200010]'
8 | bool visit[100000*2+10];
| ^~~~~
|
s778300615 | p03921 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n, m) for (int i = (int) (n); i < (int) (m); i++)
#define PB push_back
using ll = long long;
using namespace std;
void init();
void solve();
void dfsl(int);
int main()
{
init();
solve();
}
struct person {
vector<int> v;
bool f;
};
struct lang {
vector<int> v;
bool f;
};
vector<person> p;
vector<lang> l;
int N, M;
void init()
{
cin >> N >> M;
rep(i, N) {
person t;
t.f = false;
t.v.resize(0);
p.PB(t);
}
rep(i, M) {
lang t;
t.v.resize(0);
t.f = false;
l.PB(t);
}
rep(i, N) {
int k;
cin >> k;
rep(j, k) {
int t;
cin >> t;
t--;
p[i].v.PB(t);
l[t].v.PB(i);
}
}
}
void dfsp(int x)
{
if (p[x].f) return;
p[x].f = true;
for (int t : p[x].v) {
dfsl(t);
}
}
void dfsl(int x)
{
if (l[x].f) return;
l[x] = true;
for (int t : l[x].v) {
dfsp(t);
}
}
void solve()
{
dfsp(0);
rep(i, N) {
if (!p[i].f) {
cout << "NO" << endl;
return;
}
}
cout << "YES" << endl;
}
| a.cc: In function 'void dfsl(int)':
a.cc:75:16: error: no match for 'operator=' (operand types are '__gnu_cxx::__alloc_traits<std::allocator<lang>, lang>::value_type' {aka 'lang'} and 'bool')
75 | l[x] = true;
| ^~~~
a.cc:26:8: note: candidate: 'lang& lang::operator=(const lang&)'
26 | struct lang {
| ^~~~
a.cc:26:8: note: no known conversion for argument 1 from 'bool' to 'const lang&'
a.cc:26:8: note: candidate: 'lang& lang::operator=(lang&&)'
a.cc:26:8: note: no known conversion for argument 1 from 'bool' to 'lang&&'
|
s615508128 | p03921 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n, m) for (int i = (int) (n); i < (int) (m); i++)
#define PB push_back
using ll = long long;
using namespace std;
void init();
void solve();
int main()
{
init();
solve();
}
struct person {
vector<int> v;
bool f;
};
struct lang {
vector<int> v;
};
vector<person> p;
vector<lang> l;
int N, M;
void init()
{
cin >> N >> M;
rep(i, N) {
person t;
t.f = false;
t.v.resize(0);
p.PB(t);
}
rep(i, M) {
lang t;
t.v.resize(0);
l.PB(t);
}
rep(i, N) {
int k;
cin >> k;
rep(i, k) {
int t;
cin >> t;
t--;
p[i].v.PB(t);
l[t].v.PB(i);
}
}
}
void dfsp(int x)
{
if (p[x].f) return;
p[x].f = true;
for (int t : p[x].v) {
dfsl(t);
}
}
void dfsl(int x)
{
for (int t : l[x].v) {
dfsp(t);
}
}
void solve()
{
dfsp(0);
rep(i, N) {
if (!p[i].f) {
cout << "NO" << endl;
return;
}
}
cout << "YES" << endl;
}
| a.cc: In function 'void dfsp(int)':
a.cc:65:17: error: 'dfsl' was not declared in this scope; did you mean 'ffsl'?
65 | dfsl(t);
| ^~~~
| ffsl
|
s768301311 | p03921 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n, m) for (int i = (int) (n); i < (int) (m); i++)
#define PB push_back
using ll = long long;
using namespace std;
void init();
void solve();
int main()
{
init();
solve();
}
struct person {
vector<int> v;
bool f;
};
struct lang {
vector<int> v;
};
vector<person> p;
vector<lang> l;
int N, M;
void init()
{
cin >> N >> M;
rep(i, N) {
person t;
t.f = false;
t.v.resize(0);
p.PB(t);
}
rep(i, M) {
lang t;
t.v.resize(0);
l.PB(t);
}
rep(i, N) {
int k;
cin >> k;
rep(i, k) {
int t;
cin >> t;
t--;
p[i].v.PB(t);
l[t].v.PB(i);
}
}
}
void dfsp(int x)
{
if (p[x].f) return;
p[x].f = true;
for (int t : p[x].v) {
dfsl(t);
}
}
void dfsl(int x)
{
for (int t : l[x].v) {
dfsp(t);
}
}
void solve()
{
dfsp(0);
rep(i, N) {
if (!p[x].f) {
cout << "NO" << endl;
return;
}
}
cout << "YES" << endl;
}
| a.cc: In function 'void dfsp(int)':
a.cc:65:17: error: 'dfsl' was not declared in this scope; did you mean 'ffsl'?
65 | dfsl(t);
| ^~~~
| ffsl
a.cc: In function 'void solve()':
a.cc:80:24: error: 'x' was not declared in this scope
80 | if (!p[x].f) {
| ^
|
s871301464 | p03921 | C++ | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int) (n); i++)
#define reps(i, n, m) for (int i = (int) (n); i < (int) (m); i++)
#define PB push_back
using ll = long long;
using namespace std;
void init();
void solve();
int main()
{
init();
solve();
}
struct person {
vector<int> v;
bool f;
};
struct lang {
vector<int> v;
};
vector<person> p;
vector<lang> l;
int N, M;
void init()
{
cin >> N >> M;
rep(i, N) {
person t;
t.f = false;
t.v.resize(0);
p.PB(t);
}
rep(i, M) {
lang t;
t.v.resize(0);
l.PB(t);
}
rep(i, N) {
int k;
cin >> k;
rep(i, k) {
int t;
cin >> t;
t--;
p[i].v.OB(t);
l[t].v.OB(i);
}
}
}
void dfsp(int x)
{
if (p[x].f) return;
p[x].f = true;
for (int t : p[x].v) {
dfsl(t);
}
}
void dfsl(int x)
{
for (int t : l[x].v) {
dfsp(t);
}
}
void solve()
{
dfsp(0);
rep(i, N) {
if (!p[x].f) {
cout << "NO" << endl;
return;
}
}
cout << "YES" << endl;
}
| a.cc: In function 'void init()':
a.cc:54:32: error: 'class std::vector<int>' has no member named 'OB'
54 | p[i].v.OB(t);
| ^~
a.cc:55:32: error: 'class std::vector<int>' has no member named 'OB'
55 | l[t].v.OB(i);
| ^~
a.cc: In function 'void dfsp(int)':
a.cc:65:17: error: 'dfsl' was not declared in this scope; did you mean 'ffsl'?
65 | dfsl(t);
| ^~~~
| ffsl
a.cc: In function 'void solve()':
a.cc:80:24: error: 'x' was not declared in this scope
80 | if (!p[x].f) {
| ^
|
s472737788 | p03921 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define PF push_front
#define PB push_back
#define PPF pop_front
#define PPB pop_back
#define MA make_pair
#define ll long long
#define PA pair<int,int>
#define VE vector<int>
#define VP vector<PA>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
//
struct poi{
int X;int Y;int Z;
bool operator<(const poi&R)const{
return X==R.X ? Y==R.Y ? Z<R.Z : Y<R.Y : X<R.X;
}
};
//
//
int par[100000];//親
int ran[100000];//木の深さ
//初期化
void init(int N){
FOR(i,0,N){
par[i]=i;
ran[i]=0;
}
}
//木の根を求める
int find(int X){
if(par[X]==X){
return X;
}else{
return par[X]=find(par[X]);
}
}
//Xの属する集合とYの属する集合を併合
void unite(int X,int Y){
X=find(X);
Y=find(Y);
if(X==Y){
return;
}
if(rank[X]<rank[Y]){
par[X]=Y;
}else{
par[Y]=X;
if(ran[X]==ran[Y]){
ran[X]++;
}
}
}
//XとYが同じ集合に属するか否か
bool same(int X,int Y){
return find(X)==find(Y);
}
//
int N,M,K;
set<int> S[100000];
int main(){
cin>>N>>M;
FOR(i,0,N){
cin>>K;
FOR(j,0,K){
int l;
cin>>l;
l--;
S[l].insert(i);
}
}
init(N);
FOR(i,0,M){
set<int>::iterator it=S[i].begin();
if(it==S[i].end()){
continue;
}
int num=*it;
it++;
while(it!=S[i].end()){
unite(num,*it);
num=*it;
it++;
}
}
FOR(i,0,N-1){
if(!same(i,i+1)){
YES(0);
return 0;
}
}
YES(1);
return 0;
}
| a.cc: In function 'void unite(int, int)':
a.cc:62:10: error: expected unqualified-id before '[' token
62 | if(rank[X]<rank[Y]){
| ^
|
s371071875 | p03921 | C++ | #include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <bitset>
#include <cmath>
#include <string>
#define FI first
#define SE second
#define PF push_front
#define PB push_back
#define PPF pop_front
#define PPB pop_back
#define MA make_pair
#define ll long long
#define PA pair<int,int>
#define VE vector<int>
#define VP vector<PA>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ROF(i,a,b) for(int i=b-1;i>=a;i--)
#define YES(i) cout<<(i?"YES":"NO")<<endl
#define Yes(i) cout<<(i?"Yes":"No")<<endl
using namespace std;
//
const int INF=1e9+7;
const int mod=1e9+7;
//
//
struct poi{
int X;int Y;int Z;
bool operator<(const poi&R)const{
return X==R.X ? Y==R.Y ? Z<R.Z : Y<R.Y : X<R.X;
}
};
//
//
int par[100000];//親
int rank[100000];//木の深さ
//初期化
void init(int N){
FOR(i,0,N){
par[i]=i;
rank[i]=0;
}
}
//木の根を求める
int find(int X){
if(par[X]==X){
return X;
}else{
return par[X]=find(par[X]);
}
}
//Xの属する集合とYの属する集合を併合
void unite(int X,int Y){
X=find(X);
Y=find(Y);
if(X==Y){
return;
}
if(rank[X]<rank[Y]){
par[X]=Y;
}else{
par[Y]=X;
if(rank[X]==rank[Y]){
rank[X]++;
}
}
}
//XとYが同じ集合に属するか否か
bool same(int X,int Y){
return find(X)==find(Y);
}
//
int N,M,K;
set<int> S[100000];
int main(){
cin>>N>>M;
FOR(i,0,N){
cin>>K;
FOR(j,0,K){
int l;
cin>>l;
l--;
S[l].insert(i);
}
}
init(N);
FOR(i,0,M){
set<int>::iterator it=S[i].begin();
if(it==S[i].end()){
continue;
}
int num=*it;
it++;
while(it!=S[i].end()){
unite(num,*it);
num=*it;
it++;
}
}
FOR(i,0,N-1){
if(!same(i,i+1)){
YES(0);
return 0;
}
}
YES(1);
return 0;
}
| a.cc: In function 'void init(int)':
a.cc:44:5: error: reference to 'rank' is ambiguous
44 | rank[i]=0;
| ^~~~
In file included from /usr/include/c++/14/bits/move.h:37,
from /usr/include/c++/14/bits/exception_ptr.h:41,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:39:5: note: 'int rank [100000]'
39 | int rank[100000];//木の深さ
| ^~~~
a.cc: In function 'void unite(int, int)':
a.cc:62:6: error: reference to 'rank' is ambiguous
62 | if(rank[X]<rank[Y]){
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:39:5: note: 'int rank [100000]'
39 | int rank[100000];//木の深さ
| ^~~~
a.cc:62:14: error: reference to 'rank' is ambiguous
62 | if(rank[X]<rank[Y]){
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:39:5: note: 'int rank [100000]'
39 | int rank[100000];//木の深さ
| ^~~~
a.cc:66:8: error: reference to 'rank' is ambiguous
66 | if(rank[X]==rank[Y]){
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:39:5: note: 'int rank [100000]'
39 | int rank[100000];//木の深さ
| ^~~~
a.cc:66:17: error: reference to 'rank' is ambiguous
66 | if(rank[X]==rank[Y]){
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:39:5: note: 'int rank [100000]'
39 | int rank[100000];//木の深さ
| ^~~~
a.cc:67:7: error: reference to 'rank' is ambiguous
67 | rank[X]++;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:39:5: note: 'int rank [100000]'
39 | int rank[100000];//木の深さ
| ^~~~
|
s846706564 | p03921 | C++ | ///
// File: c.go
// Author: ymiyamoto
//
// Created on Fri May 25 00:05:10 2018
//
package main
import (
"fmt"
)
var N, M int
var visited []bool
var graph [][]int
var graph2 [][]int
func dfs(root int) {
visited[root] = true
for _, r := range graph[root] {
if !visited[r] {
dfs(p)
}
}
}
func main() {
fmt.Scan(&N, &M)
graph = make([][]int, N+M)
for i := range graph {
graph[i] = make([]int, 0)
}
for i := 0; i < N; i++ {
var K int
fmt.Scan(&K)
for j := 0; j < K; j++ {
var L int
fmt.Scan(&L)
L--
graph[i] = append(graph[i], N+L)
graph[N+L] = append(graph[N+L], i)
}
}
//fmt.Println(graph)
visited = make([]bool, N+M)
dfs(0)
for i := 0; i < N; i++ {
if !visited[i] {
fmt.Println("NO")
return
}
}
fmt.Println("YES")
}
| a.cc:7:1: error: 'package' does not name a type
7 | package main
| ^~~~~~~
a.cc:28:1: error: 'func' does not name a type
28 | func main() {
| ^~~~
|
s492358645 | p03921 | C++ | #include <iostream>
#include <vector>
#include <set>
using namespace std;
int N,M,K,L;
int p[100010] = {0},r[100010] = {0};
void init(int N){
for(int i=0;i<=N;++i) p[i] = i;
}
int root(int a){
if(p[a] == a) return a;
return (p[a] = root(p[a]));
}
bool is_same_set(int a,int b){
return root(a) == root(b);
}
void unite(int a, int b){
a = root(a);
b = root(b);
if(a==b) return;
if(r[a]<r[b]){
p[a] = b;
}else{
p[b] = a;
if(r[a] == r[b]) r[a]++;
}
}
int main(){
cin >> N >> M;
init(N);
set<int> S;
vector<vector<int>> v(N+1);
vector<int> r;
for(int i=1;i<=N;i++){
cin >> K;
for(int j=0;j<K;j++){
cin >> L;
v[i].push_back(L);
}
bool judge = false;
if(i>=2){
for(int j=0;j<K;j++){
if(S.find(v[i][j]) != S.end() && !is_same_set(1,i)){
unite(1,i);
judge = true;
}
}
if(judge){
for(int j=0;j<K;j++) S.insert(v[i][j]);
}else r.push_back(i);
}else{
for(int j=0;j<K;j++) S.insert(v[i][j]);
}
}
for(int i=0;i<r.size();i++){
for(int j=0;j<v[r[i]].size();j++){
if(S.find(v[r[i]][j]) != S.end()){
unite(1,i);
for(int j=0;j<K;j++) S.insert(v[i][j]);
}
}
bool ans = true;
for(int i=2;i<=N;i++){
if(!is_same_set(1,i)) ans = false;
}
if(ans) cout << "YES" << endl;
else cout << "NO" << endl;
} | a.cc: In function 'int main()':
a.cc:75:2: error: expected '}' at end of input
75 | }
| ^
a.cc:35:11: note: to match this '{'
35 | int main(){
| ^
|
s355801616 | p03921 | Java |
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Set;
import java.util.StringTokenizer;
import codefestival2016Final.C.UnionFind;
public class Main {
public static void main(String[] args) throws IOException {
InputStream inputStream = System.in;
OutputStream outputStream = System.out;
InputReader in = new InputReader(inputStream);
PrintWriter out = new PrintWriter(outputStream);
TaskX solver = new TaskX();
solver.solve(1, in, out);
out.close();
}
static int INF = 1 << 30;
static int modP = 1000000007;
static class TaskX {
public void solve(int testNumber, InputReader in, PrintWriter out) {
int n = in.nextInt();
int m = in.nextInt();
UnionFind uf = new UnionFind(n + m);
for (int i = 0; i < n; i++) {
int k = in.nextInt();
for (int j = 0; j < k; j++) {
int l = in.nextInt() - 1;
uf.link(i, l);
}
}
Set<Integer> set = new HashSet<>();
for (int i = 0; i < n; i++) {
set.add(uf.root(i));
}
out.println(set.size() > 1 ? "NO" : "YES");
}
}
static class InputReader {
BufferedReader in;
StringTokenizer tok;
public String nextString() {
while (!tok.hasMoreTokens()) {
try {
tok = new StringTokenizer(in.readLine(), " ");
} catch (IOException e) {
throw new InputMismatchException();
}
}
return tok.nextToken();
}
public int nextInt() {
return Integer.parseInt(nextString());
}
public long nextLong() {
return Long.parseLong(nextString());
}
public double nextDouble() {
return Double.parseDouble(nextString());
}
public int[] nextIntArray(int n) {
int[] res = new int[n];
for (int i = 0; i < n; i++) {
res[i] = nextInt();
}
return res;
}
public long[] nextLongArray(int n) {
long[] res = new long[n];
for (int i = 0; i < n; i++) {
res[i] = nextLong();
}
return res;
}
public InputReader(InputStream inputStream) {
in = new BufferedReader(new InputStreamReader(inputStream));
tok = new StringTokenizer("");
}
}
}
| Main.java:14: error: package codefestival2016Final.C does not exist
import codefestival2016Final.C.UnionFind;
^
Main.java:36: error: cannot find symbol
UnionFind uf = new UnionFind(n + m);
^
symbol: class UnionFind
location: class TaskX
Main.java:36: error: cannot find symbol
UnionFind uf = new UnionFind(n + m);
^
symbol: class UnionFind
location: class TaskX
3 errors
|
s287935500 | p03921 | C++ | #include<iostream>
using namespace std;
int n,m;
int p[1<<17],rank[1<<17];
int l[1<<17];
int find(int a){return p[a]-a?p[a]=find(p[a]):a;}
void unite(int a,int b)
{
int pa=find(a),pb=find(b);
if(pa==pb)return;
if(rank[pa]<rank[pb])
{
p[pa]=pb;
}
else
{
p[pb]=pa;
if(rank[pa]==rank[pb])rank[pa]++;
}
}
main()
{
cin>>n>>m;
for(int i=0;i<=n||i<=m;i++)l[i]=-1,p[i]=i;
for(int i=0;i<n;i++)
{
int k,a;
cin>>k;
for(int j=0;j<k;j++)
{
cin>>a;
if(l[a]<0)l[a]=i;
else unite(i,l[a]);
}
}
bool f=true;
for(int i=0;++i<n;)f&=find(0)==find(i);
cout<<(f?"YES":"NO")<<endl;
} | a.cc: In function 'void unite(int, int)':
a.cc:11:12: error: reference to 'rank' is ambiguous
11 | if(rank[pa]<rank[pb])
| ^~~~
In file included from /usr/include/c++/14/bits/move.h:37,
from /usr/include/c++/14/bits/exception_ptr.h:41,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:4:14: note: 'int rank [131072]'
4 | int p[1<<17],rank[1<<17];
| ^~~~
a.cc:11:21: error: reference to 'rank' is ambiguous
11 | if(rank[pa]<rank[pb])
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:4:14: note: 'int rank [131072]'
4 | int p[1<<17],rank[1<<17];
| ^~~~
a.cc:18:20: error: reference to 'rank' is ambiguous
18 | if(rank[pa]==rank[pb])rank[pa]++;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:4:14: note: 'int rank [131072]'
4 | int p[1<<17],rank[1<<17];
| ^~~~
a.cc:18:30: error: reference to 'rank' is ambiguous
18 | if(rank[pa]==rank[pb])rank[pa]++;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:4:14: note: 'int rank [131072]'
4 | int p[1<<17],rank[1<<17];
| ^~~~
a.cc:18:39: error: reference to 'rank' is ambiguous
18 | if(rank[pa]==rank[pb])rank[pa]++;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:4:14: note: 'int rank [131072]'
4 | int p[1<<17],rank[1<<17];
| ^~~~
a.cc: At global scope:
a.cc:21:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
21 | main()
| ^~~~
|
s107381945 | p03921 | C++ | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
vector<int>e[100005]{};
int par[100005];
int Rank[100005];
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;
}
else {
par[y] = x;
}
if (Rank[x] == Rank[y])Rank[x]++;
}
int main() {
int a, b;
scanf("%d%d", &a, &b);
for (int x = 0; x < a; x++) {
par[x] = x;
Rank[x] = 0;
}
for (int c = 0; c < a; c++) {
int d;
scanf("%d", &d);
for (int f = 0; f < d; f++) {
int g;
scanf("%d", &g);
g--;
e[g].push_back(c);
}
}
for (int x = 0; x < b; x++) {
if (e[x].size() >= 2) {
for (int p = 1; p < e[x].size(); p++)unite(e[x][0], e[x][p]);
}
}
set<int>k;
for (int i = 0; i < a; i++) {
k.insert(find(i));
}
if (k.size() == 1)puts("YES");
else puts("NO");
} | a.cc:4:1: error: extended character is not valid in an identifier
4 |
| ^
a.cc:4:1: error: '\U000000a0' does not name a type
4 |
| ^
a.cc: In function 'int main()':
a.cc:38:25: error: 'e' was not declared in this scope
38 | e[g].push_back(c);
| ^
a.cc:42:21: error: 'e' was not declared in this scope
42 | if (e[x].size() >= 2) {
| ^
|
s461208491 | p03921 | C++ | #include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <list>
#include <algorithm>
using namespace std;
// Returns 1 if the i-th bit of x is set, 0 otherwise.
#define BIT_SET(x, i) (((x) & (1<<(i))) != 0)
// Sets the i-th bit of x to 1
#define SET_BIT(x, i) ((x) | (1<<(i)))
// Sets the i-th bit of x to 0
#define UNSET_BIT(x, i) ((x) & ~(1<<(i)))
class Task {
private:
int count;
public:
solve(istream& in, ostream& out) {
int N, M;
cin >> N >> M;
vector<list<int>> L(N);
vector<bool> visited(N);
unordered_map<int, list<int>> spoken;
for (int j = 0; j < N; j++) {
int Kj;
cin >> Kj;
for (int k = 0; k < Kj; k++) {
int Ljk;
cin >> Ljk;
L[j].emplace_back(Ljk);
spoken[Ljk].emplace_back(j);
}
}
dfs(0, visited, L, spoken);
out << (count == N ? "YES" : "NO") << endl;
}
void dfs(int node, vector<bool>& visited, vector<list<int>>& L, unordered_map<int, list<int>>& spoken) {
count++;
visited[node] = true;
for (list<int>::iterator i = L[node].begin(); i != L[node].end(); i++) {
for (int v: spoken[*i])
if (!visited[v])
dfs(v, visited, L, spoken);
}
}
};
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
std::istream& in(std::cin);
std::ostream& out(std::cout);
Task task;
task.solve(in, out);
return 0;
}
| a.cc:22:17: error: ISO C++ forbids declaration of 'solve' with no type [-fpermissive]
22 | solve(istream& in, ostream& out) {
| ^~~~~
a.cc: In member function 'int Task::solve(std::istream&, std::ostream&)':
a.cc:40:17: warning: no return statement in function returning non-void [-Wreturn-type]
40 | }
| ^
|
s969167427 | p03921 | C | #include<stdio.h>
int lang[1000][1000],inter[1000][1000],list[1000],num,n;
int search(int i){
int f;
num++;
if(num==n) return 1;
list[i]=1;
f=0;
while(f==0){
for(j=0;j<n && f==0;j++){
if(list[j]==0 && i!=j && k[i][j]==1){
if(search(j)) return 1;
}
}
}
list[i]=0;
return 0;
}
int main(){
int m,k,i,j,l,f;
scanf("%d %d",&n,&m);
for(i=0;i<n;i++){
scanf("%d",&k);
for(j=0;j<k;j++){
scanf("%d",&l);
lang[i][l-1]=1;
for(ii=0;ii<i;ii++){
if(lang[ii][l-1]){
k[i][ii]=1;
k[ii][i]=1;
}
}
}
}
num=0;
if(search(0)) printf("YES\n");
else printf("NO\n");
return 0;
} | main.c: In function 'search':
main.c:12:21: error: 'j' undeclared (first use in this function)
12 | for(j=0;j<n && f==0;j++){
| ^
main.c:12:21: note: each undeclared identifier is reported only once for each function it appears in
main.c:13:50: error: 'k' undeclared (first use in this function)
13 | if(list[j]==0 && i!=j && k[i][j]==1){
| ^
main.c: In function 'main':
main.c:30:29: error: 'ii' undeclared (first use in this function); did you mean 'i'?
30 | for(ii=0;ii<i;ii++){
| ^~
| i
main.c:32:42: error: subscripted value is neither array nor pointer nor vector
32 | k[i][ii]=1;
| ^
|
s283820211 | p03921 | C | #include<stdio.h>
int lang[1000][1000],inter[1000][1000]list[1000],num,n;
int search(int i){
int f;
num++;
if(num==n) return 1;
list[i]=1;
f=0;
while(f==0){
for(j=0;j<n && f==0;j++){
if(list[j]==0 && i!=j && k[i][j]==1){
if(search(j)) return 1;
}
}
}
list[i]=0;
return 0;
}
int main(){
int m,k,i,j,l,f;
scanf("%d %d",&n,&m);
for(i=0;i<n;i++){
scanf("%d",&k);
for(j=0;j<k;j++){
scanf("%d",&l);
lang[i][l-1]=1;
for(ii=0;ii<i;ii++){
if(lang[ii][l-1]){
k[i][ii]=1;
k[ii][i]=1;
}
}
}
}
num=0;
if(search(0)) printf("YES\n");
else printf("NO\n");
return 0;
} | main.c:3:39: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'list'
3 | int lang[1000][1000],inter[1000][1000]list[1000],num,n;
| ^~~~
main.c: In function 'search':
main.c:7:9: error: 'num' undeclared (first use in this function)
7 | num++;
| ^~~
main.c:7:9: note: each undeclared identifier is reported only once for each function it appears in
main.c:8:17: error: 'n' undeclared (first use in this function)
8 | if(num==n) return 1;
| ^
main.c:9:9: error: 'list' undeclared (first use in this function)
9 | list[i]=1;
| ^~~~
main.c:12:21: error: 'j' undeclared (first use in this function)
12 | for(j=0;j<n && f==0;j++){
| ^
main.c:13:50: error: 'k' undeclared (first use in this function)
13 | if(list[j]==0 && i!=j && k[i][j]==1){
| ^
main.c: In function 'main':
main.c:24:24: error: 'n' undeclared (first use in this function)
24 | scanf("%d %d",&n,&m);
| ^
main.c:30:29: error: 'ii' undeclared (first use in this function); did you mean 'i'?
30 | for(ii=0;ii<i;ii++){
| ^~
| i
main.c:32:42: error: subscripted value is neither array nor pointer nor vector
32 | k[i][ii]=1;
| ^
main.c:39:9: error: 'num' undeclared (first use in this function)
39 | num=0;
| ^~~
|
s564272814 | p03921 | C | #include <stdio.h>
#include <stdbool.h>
int find(int x);
void f_union(int x, int y);
int G[1001];
typedef struct {
int K;
int O;
unsigned char other[1001];
unsigned char lang[1001];
}CODER;
CODER player[1001] = {0};
int main(void)
{
int N, M, K, n;
int i, j, k, l, m;
CODER tmp;
scanf("%d%d", &N, &M);
for (i = 0; i < N; i++) {
scanf("%d", &K);
player[i].K = K;
player[i].O = 0;
G[i] = i;
for (k = 0; k < K; k++) {
scanf("%d", &n);
player[i].lang[k] = n;
}
}
for (i = 0; i < N; i++) {
for (j = 0; j < player[i].K; j++) {
for (k = 0; k < N; k++) {
for (l = 0; l < player[k].K; l++) {
if (player[i].lang[j] == player[k].lang[l]) {
f_union(G[i], G[k]);
}
}
}
}
}
for (i = 1; i < N; i++) {
if (find(G[0]) != find(G[i])) {
printf("NO");
return 0;
}
}
printf("YES");
return 0;
}
int find(int x)
{
return G[x]==x?x:G[x] = find(G[x]);
}
void f_union(int x, int y)
{
x = find(x);
y = find(y);
if (x == y) return;
G[x] = y;
}
| main.c: In function 'find':
main.c:61:27: error: lvalue required as left operand of assignment
61 | return G[x]==x?x:G[x] = find(G[x]);
| ^
|
s728854466 | p03921 | Java | import java.io.*;
import java.lang.*;
import java.util.*;
public class Main {
static int count = 0;
static boolean[] m;
static Map<Integer, List<Integer>> spoken;
static int[][] L;
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(reader.readLine().split("\\s")[0]);
L = new int[N][];
m = new boolean[N];
spoken = new HashMap();
for (int j = 0; j < N; j++) {
String[] raw = reader.readLine().split("\\s");
L[j] = new int[Integer.parseInt(raw[0])];
for (int k = 0; k < L[j].length; k++) {
L[j][k] = Integer.parseInt(raw[k+1]);
if (!spoken.containsKey(L[j][k]))
spoken.put(L[j][k], new ArrayList());
spoken.get(L[j][k]).add(j);
}
}
dfs(0);
System.out.println(count == N ? "YES" : "NO");
}
static void dfs(int current) {
count++;
if (count == N) return;
m[current] = true;
for (int k = 0; k < L[current].length; k++) {
int lang = L[current][k];
for (int v: spoken.get(lang))
if (!m[v])
dfs(v);
}
}
}
| Main.java:34: error: cannot find symbol
if (count == N) return;
^
symbol: variable N
location: class Main
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
|
s657096255 | p03921 | C++ |
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define FORCLS(i,a,b) for(int i = (a); i <= (b); i++)
#define REPCLS(i,n) FORCLS(i,1,n)
const int NMAX = 100005;
const int MMAX = 100005;
bool adjMat[NMAX][NMAX];
int n, m;
void dfs(int s, bool* isV){
isV[s] = true;
REPCLS(i, n) if(adjMat[s][i] == true && s != i && isV[i] == false) {
dfs(i, isV);
}
}
bool isConnected() {
bool isVisited[MMAX];
fill (isVisited, isVisited + (n + 1), false);
dfs(1, isVisited);
return all_of(isVisited + 1, isVisited + (n + 1), [](bool b){return b;});
}
int main() {
vector<int> speekMans[MMAX];
cin >> n >> m;
if (n > NMAX || m > MMAX) {
return 0;
}
REPCLS(i, n){
int k;
cin >> k;
REP(j, k){
int l; cin >> l;
speekMans[l].push_back(i);
}
}
REPCLS(l, m){
for(int x : speekMans[l]) for(int y : speekMans[l]){
if (x == y) continue;
adjMat[x][y] = true;
}
}
string ans = isConnected()? "YES" : "NO";
cout << ans << endl;
return 0;
}
| /tmp/cc5HV29r.o: in function `dfs(int, bool*)':
a.cc:(.text+0x88): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc5HV29r.o
/tmp/cc5HV29r.o: in function `isConnected()':
a.cc:(.text+0xba): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc5HV29r.o
a.cc:(.text+0xfb): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc5HV29r.o
/tmp/cc5HV29r.o: in function `main':
a.cc:(.text+0x15e): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc5HV29r.o
a.cc:(.text+0x17a): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cc5HV29r.o
a.cc:(.text+0x18b): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc5HV29r.o
a.cc:(.text+0x198): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cc5HV29r.o
a.cc:(.text+0x251): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/cc5HV29r.o
a.cc:(.text+0x3b5): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/cc5HV29r.o
collect2: error: ld returned 1 exit status
|
s154071869 | p03921 | C++ | #include <fstream>
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <queue>
#include <random>
using namespace std;
#define min(a,b) ((a)<(b) ? (a):(b))
#define max(a,b) ((a)>(b) ? (a):(b))
long long gcd(long long a, long long b){
if(a<b){
swap(a,b);
}
while(b){
long long r = a%b;
a=b;
b=r;
}
return a;
}
long long lcm(long long a, long long b){
return (a*b)/gcd(a,b);
}
int isPrim(int a){
if(a==1){
return 0;
}
for(int i=2;i<=(a+1)/2;i++){
if(a%i==0){
return 0;
}
}
return 1;
}
long long mod_pow(long long x, long long n, long long mod){
//xのn乗を計算するのにn乗を2進表記にして計算
//x^22 = x^16 + x^4 + x^2
long long ret=1;
while(n>0){
if(n%2==1){
ret=(ret*x)%mod;//答えに付加
}
x=(x*x)%mod;//2乗
n=n/2;
}
return ret;
}
struct XX{
int u;
int v;
int t;
};
class xxIntu {
public:
bool operator()(const XX& riLeft, const XX& riRight) const {
//第2条件
if((riLeft.t) == (riRight.t)){
return riLeft.u < riRight.u;//<:昇順(小さいものから順番)、>:降順(大きいものから順番)
}
//第1条件
return (riLeft.t) < (riRight.t);
}
};
/*bool operator< (const XX &riLeft, const XX &riRight){
return riLeft.d < riRight.d;
};*/
int index(string in){
if(in=="A"){
return 0;
}else if(in=="B"){
return 1;
}else if(in=="C"){
return 2;
}else if(in=="D"){
return 3;
}else if(in=="E"){
return 4;
}else if(in=="F"){
return 5;
}else if(in=="G"){
return 6;
}else if(in=="H"){
return 7;
}else if(in=="I"){
return 8;
}else if(in=="J"){
return 9;
}else if(in=="K"){
return 10;
}else if(in=="L"){
return 11;
}else if(in=="M"){
return 12;
}else if(in=="N"){
return 13;
}else if(in=="O"){
return 14;
}else if(in=="P"){
return 15;
}else if(in=="Q"){
return 16;
}else if(in=="R"){
return 17;
}else if(in=="S"){
return 18;
}else if(in=="T"){
return 19;
}else if(in=="U"){
return 20;
}else if(in=="V"){
return 21;
}else if(in=="W"){
return 22;
}else if(in=="X"){
return 23;
}else if(in=="Y"){
return 24;
}else if(in=="Z"){
return 25;
}
return -1;
}
string rindex(int in){
if(in==65){
return "A";
}else if(in==66){
return "B";
}else if(in==67){
return "C";
}else if(in==68){
return "D";
}else if(in==69){
return "E";
}else if(in==70){
return "F";
}else if(in==71){
return "G";
}else if(in==72){
return "H";
}else if(in==73){
return "I";
}else if(in==74){
return "J";
}else if(in==75){
return "K";
}else if(in==76){
return "L";
}else if(in==77){
return "M";
}else if(in==78){
return "N";
}else if(in==79){
return "O";
}else if(in==80){
return "P";
}else if(in==81){
return "Q";
}else if(in==82){
return "R";
}else if(in==83){
return "S";
}else if(in==84){
return "T";
}else if(in==85){
return "U";
}else if(in==86){
return "V";
}else if(in==87){
return "W";
}else if(in==88){
return "X";
}else if(in==89){
return "Y";
}else if(in==90){
return "Z";
}
return "";
}
int ppar[100000];
int rrank[100000];
void init(int n){
for(int i=1;i<=n;i++){
ppar[i]=i;
rrank[i]=0;
}
}
int find(int x){
if(ppar[x]==x){
return x;
}else{
return ppar[x]=find(ppar[x]);
}
}
void unite(int x,int y){
x=find(x);
y=find(y);
if(x==y){
return;
}
if(rrank[x]<rrank[y]){
ppar[x]=ppar[y];
}else{
ppar[y]=x;
if(rrank[x]==rrank[y]){
rrank[x]++;
}
}
}
bool same(int x,int y){
return find(x)==find(y);
}
int main(int argc, const char * argv[])
{
//std::ios::sync_with_stdio(false);
//scanf("%s",S);
//scanf("%d",&N);
//getline(cin, target);
//cin >> x >> y;
//テスト用
//ifstream ifs( "1_06.txt" );
//ifs >> a;
//ここから
int N,M;
cin >> N >> M;
int K[100000];
int L[100000]100000;
for(int i=0;i<N;i++){
cin >> K[i];
for(int j=0;j<K[i];j++){
cin >> L[i][j];
}
}
init(M);
int kiten=L[0][0];
for(int i=0;i<N;i++){
for(int j=0;j<K[i];j++){
unite(L[i][0],L[i][j]);
}
}
for(int i=0;i<N;i++){
if(same(kiten,L[i][0])){
unite(kiten,L[i][0]);
}
}
int f=0;
for(int i=0;i<N;i++){
if(same(kiten,L[i][0])){
unite(kiten,L[i][0]);
}else{
cout << "NO" << endl;
f=1;
return 0;
}
}
if(f==0){
cout << "YES" << endl;
}
//ここまで
//cout << "ans" << endl;改行含む
//printf("%.0f\n",ans);//小数点以下表示なし
//printf("%.7f\n",p);
//printf("%f\n",pow(2,ans.size()));
return 0;
} | a.cc: In function 'int main(int, const char**)':
a.cc:252:18: error: expected initializer before numeric constant
252 | int L[100000]100000;
| ^~~~~~
a.cc:256:20: error: 'L' was not declared in this scope
256 | cin >> L[i][j];
| ^
a.cc:261:15: error: 'L' was not declared in this scope
261 | int kiten=L[0][0];
| ^
|
s085939573 | p03921 | C++ | #include<iostream>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
using namespace std;
#define forn(i,n) for(int i=0;i<(int)(n); i++)
#define forsn(i,s,n) for(int i=(s);i<(int)(n); i++)
vector<int> parent, rank;
int find(int a){
if(parent[a]!=a){
parent[a] = find(parent[a]);
}
return parent[a];
}
void uni(int a, int b){
int pa=find(a);
int pb=find(b);
if (rank[pa]>rank[pb]){
parent[pb]=pa;
}else{
parent[pa]=pb;
}
if(rank[pb]==rank[pa]){
rank[pa]++;
}
}
int main(){
int n, m;
cin>>n>>m;
forn(i, m){
parent.push_back(i);
rank.push_back(0);
}
bool aparece[m];
forn(i, m){
aparece[i]=false;
}
forn(i, n){
int k;
cin>>k;
int lp;
forn(j, k){
int l;
cin>>l;
l--;
aparece[l]=true;
if(j==0){
lp=l;
}else{
//cout<<"uno "<<lp<<" "<<l<<endl;
uni(lp, l);
}
}
}
set<int> ss;
forn(i, m){
if(aparece[i]) {
find(i);
ss.insert(parent[i]);
}
}
if(ss.size()==1){
cout<<"YES"<<endl;
}else{
cout<<"NO"<<endl;
}
}
| a.cc: In function 'void uni(int, int)':
a.cc:25:13: error: reference to 'rank' is ambiguous
25 | if (rank[pa]>rank[pb]){
| ^~~~
In file included from /usr/include/c++/14/bits/move.h:37,
from /usr/include/c++/14/bits/exception_ptr.h:41,
from /usr/include/c++/14/exception:166,
from /usr/include/c++/14/ios:41,
from /usr/include/c++/14/ostream:40,
from /usr/include/c++/14/iostream:41,
from a.cc:1:
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:13:21: note: 'std::vector<int> rank'
13 | vector<int> parent, rank;
| ^~~~
a.cc:25:22: error: reference to 'rank' is ambiguous
25 | if (rank[pa]>rank[pb]){
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:13:21: note: 'std::vector<int> rank'
13 | vector<int> parent, rank;
| ^~~~
a.cc:30:12: error: reference to 'rank' is ambiguous
30 | if(rank[pb]==rank[pa]){
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:13:21: note: 'std::vector<int> rank'
13 | vector<int> parent, rank;
| ^~~~
a.cc:30:22: error: reference to 'rank' is ambiguous
30 | if(rank[pb]==rank[pa]){
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:13:21: note: 'std::vector<int> rank'
13 | vector<int> parent, rank;
| ^~~~
a.cc:31:17: error: reference to 'rank' is ambiguous
31 | rank[pa]++;
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:13:21: note: 'std::vector<int> rank'
13 | vector<int> parent, rank;
| ^~~~
a.cc: In function 'int main()':
a.cc:40:17: error: reference to 'rank' is ambiguous
40 | rank.push_back(0);
| ^~~~
/usr/include/c++/14/type_traits:1437:12: note: candidates are: 'template<class> struct std::rank'
1437 | struct rank
| ^~~~
a.cc:13:21: note: 'std::vector<int> rank'
13 | vector<int> parent, rank;
| ^~~~
|
s269101783 | p03921 | C++ |
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define FORCLS(i,a,b) for(int i = (a); i <= (b); i++)
#define REPCLS(i,n) FORCLS(i,1,n)
const int NMAX = 100005;
const int MMAX = 100005;
bool adjMat[NMAX][NMAX];
int n, m;
bool isDist2(int s){
int v = s;
bool reach[NMAX];
fill(reach, reach+(n+1), false);
vector<int> q;
REPCLS(j, n) if(adjMat[v][j] == true) {
q.push_back(j);
reach[j] = true;
}
for(int x : q) {
REPCLS(j, n) if(adjMat[x][j] == true){
reach[j] = true;
}
}
reach[v] = true;
return all_of(reach + 1, reach + (n + 1), [](bool b){return b;});
}
int main() {
vector<int> speekMans[MMAX];
cin >> n >> m;
REPCLS(i, n){
int k;
cin >> k;
REP(j, k){
int l; cin >> l;
speekMans[l].push_back(i);
}
}
REPCLS(l, m){
for(int x : speekMans[l]) for(int y : speekMans[l]){
if (x == y) continue;
adjMat[x][y] = true;
}
}
string ans = "YES";
REPCLS(i, n){
if (!isDist2(i)) {
ans = "NO";
break;
}
}
cout << ans << endl;
return 0;
}
| /tmp/ccIBFVEd.o: in function `isDist2(int)':
a.cc:(.text+0x34): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccIBFVEd.o
a.cc:(.text+0xe7): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccIBFVEd.o
a.cc:(.text+0x17c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccIBFVEd.o
a.cc:(.text+0x1c4): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccIBFVEd.o
/tmp/ccIBFVEd.o: in function `main':
a.cc:(.text+0x25e): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccIBFVEd.o
a.cc:(.text+0x27a): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccIBFVEd.o
a.cc:(.text+0x32c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccIBFVEd.o
a.cc:(.text+0x490): relocation truncated to fit: R_X86_64_PC32 against symbol `m' defined in .bss section in /tmp/ccIBFVEd.o
a.cc:(.text+0x50c): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccIBFVEd.o
collect2: error: ld returned 1 exit status
|
s153460608 | p03921 | C++ | #include <bits/stdc++.h>
#define mp make_pair
#define mt make_tuple
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
const int INF=1<<29;
const double EPS=1e-9;
const ll MOD = 1000000007;
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
const int MAX_NM = 100100;
int N,M;
vector<int> learn_person[MAX_NM];
vector<int> edges[MAX_NM];
bool visited[MAX_NM];
int cnt_N;
void dfs(int pos){
visited[pos] = true;
cnt_N--;
if (cnt_N <= 0)return ;
for (const auto &lang : edges[pos]){
for (const auto &next : learn_person[lang]){
if (visited[next])continue;
dfs(next);
}
}
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cin >> N >> M;
cnt_N = N;
set<int> learn_lang;
for (int i = 0; i < N; i++){
int K;
cin >> K;
for (int j = 0; j < K; j++){
int l;
cin >> l;
l--;
learn_person[l].emplace_back(i);
edges[i].emplace_back(l);
}
}
dfs(0);
bool ok = true;
for (int i = 0; i < N; i++){
if (not visited[i]){
ok = false;
}
}
if (ok){
cout << "YES" << endl;
}else{
cout << "NO" << endl;
}
return 0;
|
| a.cc: In function 'int main()':
a.cc:75:1: error: expected primary-expression before '|' token
75 | |
| ^
a.cc:75:2: error: expected primary-expression at end of input
75 | |
| ^
a.cc:75:2: error: expected '}' at end of input
a.cc:41:11: note: to match this '{'
41 | int main(){
| ^
|
s069691584 | p03921 | C++ | #include <bits/stdc++.h>
#define mp make_pair
#define mt make_tuple
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
const int INF=1<<29;
const double EPS=1e-9;
const ll MOD = 1000000007;
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
const int MAX_NM = 100100;
int N,M;
vector<int> learn_person[MAX_NM];
vector<int> edges[MAX_NM];
bool visited[MAX_NM];
void dfs(int pos){
visited[pos] = true;
M--;
if (M == 0)return ;
for (const auto &lang : edges[pos]){
for (const auto &next : learn_person[lang]){
if (visited[next])continue;
dfs(next);
}
}
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
cin >> N >> M;
set<int> learn_lang;
for (int i = 0; i < N; i++){
int K;
cin >> K;
for (int j = 0; j < K; j++){
int l;
cin >> l;
l--;
learn_person[l].emplace_back(i);
edges[i].emplace_back(l);
}
}
dfs(0);
bool ok = true;
for (int i = 0; i < N; i++){
if (not visited[i]){
ok = false;
}
}
if (ok){
cout << "YES" << endl;
}else{
cout << "NO" << endl;
}
return 0;
| a.cc: In function 'int main()':
a.cc:71:12: error: expected '}' at end of input
71 | return 0;
| ^
a.cc:40:11: note: to match this '{'
40 | int main(){
| ^
|
s134679510 | p03921 | C++ | #include <bits/stdc++.h>
#define mp make_pair
#define mt make_tuple
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
const int INF=1<<29;
const double EPS=1e-9;
const ll MOD = 1000000007;
const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};
#ifdef _MSC_VER
#include <Windows.h>
double get_ms() { return (double)GetTickCount64() / 1000; }
#else
#include <sys/time.h>
double get_ms() { struct timeval t; gettimeofday(&t, NULL); return (double)t.tv_sec * 1000 + (double)t.tv_usec / 1000; }
#endif
class Timer
{
private:
double start_time;
double elapsed;
#ifdef USE_RDTSC
double get_sec() { return get_absolute_sec(); }
#else
double get_sec() { return get_ms() / 1000; }
#endif
public:
Timer() {}
void start() { start_time = get_sec(); }
double get_elapsed() { return elapsed = get_sec() - start_time; }
};
const int MAX_NM = 100100;
int N,M;
vector<int> learn_person[MAX_NM];
vector<int> edges[MAX_NM];
bool visited[MAX_NM];
Timer timer;
bool timeout;
int cnt;
void dfs(int pos){
visited[pos] = true;
for (const auto &lang : edges[pos]){
for (const auto &next : learn_person[lang]){
cnt++;
u if (cnt >= 600000000){
timeout = true;
return ;
}
if (visited[next])continue;
dfs(next);
}
}
}
int main(){
timeout = false;
timer.start();
cin.tie(0);
ios::sync_with_stdio(false);
cin >> N >> M;
set<int> learn_lang;
timer.start();
for (int i = 0; i < N; i++){
int K;
cin >> K;
for (int j = 0; j < K; j++){
int l;
cin >> l;
l--;
learn_person[l].emplace_back(i);
edges[i].emplace_back(l);
}
}
dfs(0);
if (timeout){
cout << "YES" << endl;
return 0;
}
bool ok = true;
for (int i = 0; i < N; i++){
if (not visited[i]){
ok = false;
}
}
if (ok){
cout << "YES" << endl;
}else{
cout << "NO" << endl;
}
return 0;
}
| a.cc: In function 'void dfs(int)':
a.cc:61:1: error: 'u' was not declared in this scope
61 | u if (cnt >= 600000000){
| ^
|
s052959322 | p03921 | C++ | #include "bits/stdc++.h"
#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;
set<int> mergeSet(set<int> s1, set<int> s2) {
for each (int ele in s2) {
s1.insert(ele);
}
return s1;
}
void solve() {
#ifdef _WIN32
istream &cin = ifstream("input.txt");
#endif
int n, m;
cin >> n >> m;
vector<set<int>> lang(m);
rep(i, n) {
int k, tmp;
cin >> k;
rep(j, k) {
cin >> tmp;
lang[--tmp].insert(i);
}
}
bool mergeFlag = false;
set<int> canCommunicate;
rep(i, m) {
mergeFlag = false;
if (canCommunicate.size() == 0 && lang[i].size() > 1) canCommunicate = mergeSet(lang[i], canCommunicate);
if (lang[i].size() < 2) continue;
for each (int e in lang[i]) {
if (canCommunicate.find(e) != canCommunicate.end()) {
mergeFlag = true;
break;
}
}
if (mergeFlag) canCommunicate = mergeSet(canCommunicate, lang[i]);
}
cout << (canCommunicate.size() == n ? "YES" : "NO") << endl;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
solve();
#ifdef _WIN32
system("PAUSE");
#endif
return 0;
} | a.cc: In function 'std::set<int> mergeSet(std::set<int>, std::set<int>)':
a.cc:13:13: error: expected '(' before 'each'
13 | for each (int ele in s2) {
| ^~~~
| (
a.cc:13:19: error: expected primary-expression before 'int'
13 | for each (int ele in s2) {
| ^~~
a.cc:13:13: error: 'each' was not declared in this scope
13 | for each (int ele in s2) {
| ^~~~
a.cc:16:9: error: expected primary-expression before 'return'
16 | return s1;
| ^~~~~~
a.cc:15:10: error: expected ';' before 'return'
15 | }
| ^
| ;
16 | return s1;
| ~~~~~~
a.cc:16:9: error: expected primary-expression before 'return'
16 | return s1;
| ^~~~~~
a.cc:15:10: error: expected ')' before 'return'
15 | }
| ^
| )
16 | return s1;
| ~~~~~~
a.cc:13:13: note: to match this '('
13 | for each (int ele in s2) {
| ^~~~
a.cc: In function 'void solve()':
a.cc:44:21: error: expected '(' before 'each'
44 | for each (int e in lang[i]) {
| ^~~~
| (
a.cc:44:27: error: expected primary-expression before 'int'
44 | for each (int e in lang[i]) {
| ^~~
a.cc:44:21: error: 'each' was not declared in this scope
44 | for each (int e in lang[i]) {
| ^~~~
a.cc:50:17: error: expected primary-expression before 'if'
50 | if (mergeFlag) canCommunicate = mergeSet(canCommunicate, lang[i]);
| ^~
a.cc:49:18: error: expected ';' before 'if'
49 | }
| ^
| ;
50 | if (mergeFlag) canCommunicate = mergeSet(canCommunicate, lang[i]);
| ~~
a.cc:50:17: error: expected primary-expression before 'if'
50 | if (mergeFlag) canCommunicate = mergeSet(canCommunicate, lang[i]);
| ^~
a.cc:49:18: error: expected ')' before 'if'
49 | }
| ^
| )
50 | if (mergeFlag) canCommunicate = mergeSet(canCommunicate, lang[i]);
| ~~
a.cc:44:21: note: to match this '('
44 | for each (int e in lang[i]) {
| ^~~~
a.cc: In function 'std::set<int> mergeSet(std::set<int>, std::set<int>)':
a.cc:17:1: warning: control reaches end of non-void function [-Wreturn-type]
17 | }
| ^
|
s470164140 | p03922 | C++ | #include<bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1000000000000;
const int mod = 1000000007;
int dx[4] = { 1, 0, -1, 0 }, dy[4] = { 0, 1, 0, -1 };
int test[12345678], aa[12345678];
signed main() {
int n, m, a, ans = 0; cin >> n >> m;
for (int h = 0; h < n; h++) { cin >> a; test[a % m]++; aa[a]++; }
ans += test[0] / 2; test[0] = 0;
for (int h = 1; h < m; h++) {
if (h != (m - h)) {
int x = test[h], y = test[m - h];
ans += min(x, y); test[h] -= min(x, y); test[m - h] -= min(x, y);
}
else { ans += test[h] / 2; test[h] = 0; }
}
for (int h = 1; h <= 100000; h++) { ans += min(test[h % m], aa[h]) / 2; test[h % m] -= aa[h];
cout << ans << endl; return 0;
} | a.cc: In function 'int main()':
a.cc:21:2: error: expected '}' at end of input
21 | }
| ^
a.cc:8:15: note: to match this '{'
8 | signed main() {
| ^
|
s727382161 | p03922 | C++ | #include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int n,m,x,ans;
map<int,int>mp;
int cnt[100010][2];//[mod M] 1:pair
int main(){
cin>>n>>m;
rep(i,n){
cin>>x;
mp[x]++;
}
for(P p:mp){
cnt[p.first%m][0]+=p.second%2;
cnt[p.first%m][1]+=p.second/2;
}
for(int i=0;i<=m/2;i++){
if(cnt[i][0]+cnt[i][1]>=cnt[m-i][0]+cnt[m-i][1]){
ans+=cnt[m-i][0]+cnt[m-i][1];
ans+=min(cnt[i][1],((cnt[i][0]+cnt[i][1])-(cnt[m-i][0]+cnt[m-i][1]))/2);
}
else{
ans+=cnt[i][0]+cnt[i][1];
ans+=min(cnt[i][1],((cnt[i][0]+cnt[i][1])-(cnt[m-i][0]+cnt[m-i][1]))/2);
| a.cc: In function 'int main()':
a.cc:13:13: error: 'P' was not declared in this scope
13 | for(P p:mp){
| ^
a.cc:17:9: error: expected primary-expression before 'for'
17 | for(int i=0;i<=m/2;i++){
| ^~~
a.cc:16:10: error: expected ';' before 'for'
16 | }
| ^
| ;
17 | for(int i=0;i<=m/2;i++){
| ~~~
a.cc:17:9: error: expected primary-expression before 'for'
17 | for(int i=0;i<=m/2;i++){
| ^~~
a.cc:16:10: error: expected ')' before 'for'
16 | }
| ^
| )
17 | for(int i=0;i<=m/2;i++){
| ~~~
a.cc:13:12: note: to match this '('
13 | for(P p:mp){
| ^
a.cc:24:97: error: expected '}' at end of input
24 | ans+=min(cnt[i][1],((cnt[i][0]+cnt[i][1])-(cnt[m-i][0]+cnt[m-i][1]))/2);
| ^
a.cc:22:21: note: to match this '{'
22 | else{
| ^
a.cc:24:97: error: expected '}' at end of input
24 | ans+=min(cnt[i][1],((cnt[i][0]+cnt[i][1])-(cnt[m-i][0]+cnt[m-i][1]))/2);
| ^
a.cc:17:32: note: to match this '{'
17 | for(int i=0;i<=m/2;i++){
| ^
a.cc:24:97: error: expected '}' at end of input
24 | ans+=min(cnt[i][1],((cnt[i][0]+cnt[i][1])-(cnt[m-i][0]+cnt[m-i][1]))/2);
| ^
a.cc:7:11: note: to match this '{'
7 | int main(){
| ^
|
s274059022 | p03922 | C++ | #include <bits/stdc++.h>
#define sp ' '
#define nyan "(=^・ω・^=)"
#define mkp make_pair
#define intmax 2147483647
#define llmax 9223372036854775807
#define lP pair<ll,ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;
const int mod = 1000000007;
const int mod998 = 998244353;
int N, M, X, res;
vector<int>v[100000];
int main() {
cin >> N >> M;
for (int i = 0; i < N; ++i) {
cin >> X;
v[X % M].push_back(X);
}
res += v[0].size() / 2;
for (int i = 1; i < M; ++i) {
if (i + i == M) {
res += v[i].size() / 2;
}
else if (v[i].size() > v[M - i].size() || (v[i].size() == v[M - i].size() && i <= M - i)) {
res += v[M - i].size();
map<int, int>mp;
for (int j : v[i]) {
++mp[j];
}
unsigned int c = 0;
for (auto it = mp.begin(); it != mp.end(); ++it) {
c += it->second / 2;
}
res += min((v[i].size() - v[M - i].size()) / 2, c);
}
}
cout << res << endl;
return 0;
} | a.cc: In function 'int main()':
a.cc:38:35: error: no matching function for call to 'min(std::vector<int>::size_type, unsigned int&)'
38 | res += min((v[i].size() - v[M - i].size()) / 2, c);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:38:35: note: deduced conflicting types for parameter 'const _Tp' ('long unsigned int' and 'unsigned int')
38 | res += min((v[i].size() - v[M - i].size()) / 2, c);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:38:35: note: mismatched types 'std::initializer_list<_Tp>' and 'long unsigned int'
38 | res += min((v[i].size() - v[M - i].size()) / 2, c);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s603730923 | p03922 | C++ | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
template <class T = ll> T in() { T x; cin >> x; return (x); }
typedef long long ll;
signed main() {
ll n,m;
cin >> n >> m;
ll res[m];//あまりごとの個数
ll dis[m];//あまりごとの緩衝材
ll yoo[100010];//緩衝材
REP (i,m) {res[i] = 0;dis[i] = 0;}
REP (i,100010) {yoo[i] = 0;}
REP (i,n) {ll x = in();res[x%m]++;yoo[x]++;}
REP (i,100010) {dis[i%m] += (yoo[i] / 2) * 2;}
ll ans = 0;
ans += res[0] / 2;
FOR (i,1,(m-1)/2+1) {
ll A = i,B = m - i;// res[A] < res[B];
if (res[A] == res[B]) {ans += res[A];continue;}
else if (res[A] > res[B]) swap(A,B);
ans += res[A] + min((res[B] - res[A]),dis[B]) / 2;
}
if (m%2 == 0) ans += res[m/2] / 2;
cout << ans << endl;
} | a.cc:8:21: error: 'll' does not name a type
8 | template <class T = ll> T in() { T x; cin >> x; return (x); }
| ^~
a.cc: In function 'int main()':
a.cc:22:29: error: no matching function for call to 'in()'
22 | REP (i,n) {ll x = in();res[x%m]++;yoo[x]++;}
| ~~^~
a.cc:8:27: note: candidate: 'template<class T> T in()'
8 | template <class T = ll> T in() { T x; cin >> x; return (x); }
| ^~
a.cc:8:27: note: template argument deduction/substitution failed:
|
s375271927 | p03922 | C++ | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
typedef long long ll;
signed main() {
ll n,m;
cin >> n >> m;
ll res[m];//あまりごとの個数
ll dis[m];//あまりごとの緩衝材
ll yoo[100010];//緩衝材
REP (i,m) {res[i] = 0;dis[i] = 0;}
REP (i,100010) {yoo[i] = 0;}
REP (i,n) {ll x = in();res[x%m]++;yoo[x]++;}
REP (i,100010) {dis[i%m] += (yoo[i] / 2) * 2;}
ll ans = 0;
ans += res[0] / 2;
FOR (i,1,(m-1)/2+1) {
ll A = i,B = m - i;// res[A] < res[B];
if (res[A] == res[B]) {ans += res[A];continue;}
else if (res[A] > res[B]) swap(A,B);
ans += res[A] + min((res[B] - res[A]),dis[B]) / 2;
}
if (m%2 == 0) ans += res[m/2] / 2;
cout << ans << endl;
} | a.cc: In function 'int main()':
a.cc:20:27: error: 'in' was not declared in this scope; did you mean 'i'?
20 | REP (i,n) {ll x = in();res[x%m]++;yoo[x]++;}
| ^~
| i
|
s083003474 | p03922 | C++ | #include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll>
#define m_p make_pair
#define V vector<ll>
ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x[ohara],y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
map<ll,ll> mp;
map<ll,ll> cou;
map<ll,ll> herasu;
bool vi[ohara];
ll kosuu;
P p[ohara];
ll p_cou;
ll dat[ohara];
//-------------------------↓↓↓↓↓↓------------------------
int main(void){
cin.tie(0);
ios::sync_with_stdio(false);
//[{%m,m}]=個数
cin>>n>>m;
rep(i,n)cin>>x[i];
rep(i,n){
cou[x[i]]++;
mp[x[i]%m]++;
}
rep(i,n){
if((x[i]%m)!=m-(x[i]%m)&&x[i]%m!=0){
//cerr<<i<<" "<<mp[i]<<" ";
ans+=min(mp[x[i]%m],mp[m-(x[i]%m)]);
herasu[x[i]%m]+=min(mp[x[i]%m],mp[m-(x[i]%m)]);
herasu[m-(x[i]%m)]+=min(mp[x[i]%m],mp[m-(x[i]%m)]);
pos=mp[x[i]%m];
mp[x[i]%m]-=min(mp[x[i]%m],mp[m-(x[i]%m)]);
mp[m-(x[i]%m)]-=min(pos,mp[m-(x[i]%m)]);
}
else{
ans+=mp[x[i]%m]/2;
herasu[x[i]%m]+=(mp[x[i]%m]/2)*2;
mp[x[i]%m]%=2;
}
}
rep(i,n){
if(vi[x[i]])continue;
vi[x[i]]=true;
p[p_cou++]=m_p(cou[x[i]],x[i]%m);
}
sort(p,p+p_cou);
reverse(p,p_cou);
rep(i,p_cou){
if(p[i].fi%2==herasu[p[i].se]%2){
dat[p[i].se]++;
p[i].fi--;
}
//p[i].fi/=2;
}
rep(i,m){
herasu[i]-=dat[i];
if(herasu[i]<0)herasu[i]=0;
}
rep(i,p_cou){
cnt+=max(p[i].fi-herasu[p[i].se],0LL)/2;
//cout<<p[i].fi<<"\n";
}
//Cerr(cnt);
//rep(i,m)cnt-=herasu[i],cerr<<herasu[i]<<"\n";
//rep(i,m)cnt-=herasu[i],cout<<i<<" "<<herasu[i]<<"\n";
Cout(ans+cnt);
return 0;
}
| a.cc: In function 'int main()':
a.cc:74:12: error: no matching function for call to 'reverse(std::pair<long long int, long long int> [1000010], ll&)'
74 | reverse(p,p_cou);
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:61,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: candidate: 'template<class _BIter> void std::reverse(_BIter, _BIter)'
1083 | reverse(_BidirectionalIterator __first, _BidirectionalIterator __last)
| ^~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1083:5: note: template argument deduction/substitution failed:
a.cc:74:12: note: deduced conflicting types for parameter '_BIter' ('std::pair<long long int, long long int>*' and 'long long int')
74 | reverse(p,p_cou);
| ~~~~~~~^~~~~~~~~
In file included from /usr/include/c++/14/algorithm:86:
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate: 'template<class _ExecutionPolicy, class _BidirectionalIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, void> std::reverse(_ExecutionPolicy&&, _BidirectionalIterator, _BidirectionalIterator)'
249 | reverse(_ExecutionPolicy&& __exec, _BidirectionalIterator __first, _BidirectionalIterator __last);
| ^~~~~~~
/usr/include/c++/14/pstl/glue_algorithm_defs.h:249:1: note: candidate expects 3 arguments, 2 provided
|
s068818700 | p03922 | C++ | #include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <utility>
#include <map>
using namespace std;
template <class RandomIt, class T>
ptrdiff_t num_element(RandomIt first, RandomIt last, T value, T lb_, T ub_) {
RandomIt ub=upper_bound(first, last, make_pair(value, ub_));
RandomIt lb=lower_bound(first ,last, make_pair(value, lb_));
return ub-lb;
}
bool testcase_ends() {
size_t N;
int M;
if (scanf("%zu %d", &N, &M) == EOF)
return 1;
vector<pair<int, int>> X(N);
map<int, int> maxrem;
for (size_t i=0; i<N; ++i) {
scanf("%d", &X[i].first);
X[i].second = X[i].first/M;
X[i].first %= M;
maxrem[X[i].first] = max(maxrem[X[i].first], X[i].second);
}
sort(X.begin(), X.end());
size_t res=0;
for (int i=0; i<=M/2; ++i) {
ptrdiff_t upper=num_element(X.begin(), X.end(), M-i, 0, 200000);
ptrdiff_t lower=num_element(X.begin(), X.end(), i, 0, 200000);
if (i == M-i || i == 0) {
res += lower/2;
continue;
}
long long pairs=min(upper, lower);
long long remain=abs(upper-lower);
if (remain < 2) {
res += pairs;
continue;
}
int k=(lower<upper? M-i:i);
int ub=maxrem[k];
long long cur=0;
for (int j=0; j<=ub&&cur<min(upper, lower); ++j)
cur += num_element(X.begin(), X.end(), k, j, j)/2;
res += min(cur+pairs, (upper+lower)/2);
}
printf("%zu\n", res);
return 0;
}
int main() {
bool solved=false;
while (!testcase_ends())
solved |= 1;
return !solved;
}
| a.cc: In function 'bool testcase_ends()':
a.cc:59:19: error: no matching function for call to 'min(long long int, ptrdiff_t)'
59 | res += min(cur+pairs, (upper+lower)/2);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/vector:62,
from a.cc:2:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
233 | min(const _Tp& __a, const _Tp& __b)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: template argument deduction/substitution failed:
a.cc:59:19: note: deduced conflicting types for parameter 'const _Tp' ('long long int' and 'ptrdiff_t' {aka 'long int'})
59 | res += min(cur+pairs, (upper+lower)/2);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algobase.h:281: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:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
5686 | min(initializer_list<_Tp> __l)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
5696 | min(initializer_list<_Tp> __l, _Compare __comp)
| ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: template argument deduction/substitution failed:
a.cc:59:19: note: mismatched types 'std::initializer_list<_Tp>' and 'long long int'
59 | res += min(cur+pairs, (upper+lower)/2);
| ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
s514171075 | p03922 | C++ | #include<set>
#include<map>
#include<cmath>
#include<queue>
#include<bitset>
#include<string>
#include<cstdio>
#include<cctype>
#include<cassert>
#include<cstdlib>
#include<cstring>
#include<sstream>
#include<iostream>
#include<algorithm>
#define For(i,x,y) for (int i=x;i<y;i++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
int IN(){
int c,f,x;
while (!isdigit(c=getchar())&&c!='-');c=='-'?(f=1,x=0):(f=0,x=c-'0');
while (isdigit(c=getchar())) x=(x<<1)+(x<<3)+c-'0';return !f?x:-x;
}
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> Vi;
const int N=1e5+19;
int A[N],B[N],C[N];
int n,m,res;
void work(int &x,int &y){
int tmp=min(x,y);
x-=tmp,y-=tmp,res+=tmp;.
}
int main(){
n=IN();m=IN();
For(i,0,n) A[IN()]++;
For(i,0,N){
B[i%m]+=A[i]%2;
C[i%m]+=A[i]-A[i]%2;
}
for (int i=1;2*i<m;i++){
work(B[i],B[m-i]);
work(B[i],C[m-i]);
work(C[i],B[m-i]);
res+=C[i]/2;
res+=C[m-i]/2;
}
if (m%2==0) res+=C[m/2];
res+=C[0];
printf("%d\n",res);
} | a.cc: In function 'void work(int&, int&)':
a.cc:43:32: error: expected primary-expression before '.' token
43 | x-=tmp,y-=tmp,res+=tmp;.
| ^
a.cc:44:1: error: expected unqualified-id before '}' token
44 | }
| ^
|
s359963412 | p03923 | C | #include<math.h>
using namespace std;
long N,A;
main()
{
scanf("%ld%ld",&N,&A);
long ans=N;
for(int k=1;k<40;k++)
{
long p=pow(N,1./(k+1));
long now=1;
for(int i=0;i<k;i++)now*=p;
for(int i=0;i<=k;i++)
{
ans=fmin(ans,A*k+p*k+i+(N+now-1)/now);
now=now/p*(p+1);
}
}
printf("%ld\n",ans);
} | main.c:2:1: error: unknown type name 'using'
2 | using namespace std;
| ^~~~~
main.c:2:17: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'std'
2 | using namespace std;
| ^~~
main.c:4:1: error: return type defaults to 'int' [-Wimplicit-int]
4 | main()
| ^~~~
main.c: In function 'main':
main.c:6:9: error: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
6 | scanf("%ld%ld",&N,&A);
| ^~~~~
main.c:2:1: note: include '<stdio.h>' or provide a declaration of 'scanf'
1 | #include<math.h>
+++ |+#include <stdio.h>
2 | using namespace std;
main.c:6:9: warning: incompatible implicit declaration of built-in function 'scanf' [-Wbuiltin-declaration-mismatch]
6 | scanf("%ld%ld",&N,&A);
| ^~~~~
main.c:6:9: note: include '<stdio.h>' or provide a declaration of 'scanf'
main.c:19:9: error: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
19 | printf("%ld\n",ans);
| ^~~~~~
main.c:19:9: note: include '<stdio.h>' or provide a declaration of 'printf'
main.c:19:9: warning: incompatible implicit declaration of built-in function 'printf' [-Wbuiltin-declaration-mismatch]
main.c:19:9: note: include '<stdio.h>' or provide a declaration of 'printf'
|
s101157614 | p03923 | C++ | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def pow(a, b):
if b == 1:return a
if b%2 == 0: return pow(a*a, int(b/2))
return a*pow(a*a, int(b/2))
def binaryOne(n, multi):
l, r = 0, n
mid = (l + r)/2
while r - l > 1:
if pow(mid, multi) >= n:
r = mid
else:
l = mid
mid = (r + l)/2
return r;
def binaryTwo(n, maxi, multi):
l, r = 0, multi
mid = (l + r)/2
while r - l > 1:
if pow(maxi, (multi - mid))*pow(maxi - 1, mid) >= n:
l = mid
else:
r = mid
mid = (r + l)/2;
return l
n, a = map(int,raw_input().split(" "))
ans = 1e18
for i in xrange(0, 40):
maxi = binaryOne(n, i + 1);
subt = binaryTwo(n, maxi, i + 1)
ans = min(ans, a*i + maxi*(i + 1) - subt)
print ans
| a.cc:1:2: error: invalid preprocessing directive #!
1 | #!/usr/bin/env python
| ^
a.cc:2:3: error: invalid preprocessing directive #-
2 | # -*- coding: utf-8 -*-
| ^
a.cc:4:1: error: 'def' does not name a type
4 | def pow(a, b):
| ^~~
a.cc:21:1: error: 'def' does not name a type
21 | def binaryTwo(n, maxi, multi):
| ^~~
a.cc:30:5: error: expected unqualified-id before 'return'
30 | return l
| ^~~~~~
a.cc:36:5: error: 'subt' does not name a type
36 | subt = binaryTwo(n, maxi, i + 1)
| ^~~~
|
s138572853 | p03923 | C++ | int dp[1000001]; //dp[x] = minTime
int n, a;
int main() {
cin >> n >> a;
for (int i = 0; i <= n; i++) {
dp[i] = 1145141919;
}
dp[1] = 0;
for (int i = 1; i < n; i++) {
for (int j = i; j <= n; j += i) {
dp[j] = min(dp[j], dp[i] + j / i + a);
}
}
if (n == 1) { cout << 1 << endl; return 0; }
else { cout << dp[n] - a << endl; return 0; }
return 0;
} | a.cc: In function 'int main()':
a.cc:5:1: error: 'cin' was not declared in this scope
5 | cin >> n >> a;
| ^~~
a.cc:13:25: error: 'min' was not declared in this scope; did you mean 'main'?
13 | dp[j] = min(dp[j], dp[i] + j / i + a);
| ^~~
| main
a.cc:16:15: error: 'cout' was not declared in this scope
16 | if (n == 1) { cout << 1 << endl; return 0; }
| ^~~~
a.cc:16:28: error: 'endl' was not declared in this scope
16 | if (n == 1) { cout << 1 << endl; return 0; }
| ^~~~
a.cc:17:8: error: 'cout' was not declared in this scope
17 | else { cout << dp[n] - a << endl; return 0; }
| ^~~~
a.cc:17:29: error: 'endl' was not declared in this scope
17 | else { cout << dp[n] - a << endl; return 0; }
| ^~~~
|
s192833007 | p03923 | C++ | #include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
if(p) cout << fixed << setprecision(p) << a << "\n";
else cout << a << "\n";
}
// end of template
ll N, A;
ll ok(ll K){
ll per = 1;
ll ret = LONG_LONG_MAX;
ll time = 0;
while(1){
if(N <= per * (2 * K + A)){
ret = min(ret, time + (N - 1) / per + 1);
}
if(N <= per * (K + A)){
ret = min(ret, time + (N - 1) / per + 1);
// time += (N - 1) / per + 1;
break;
}
time += K + A;
per *= K;
if(time > N) return -1;
}
if(ret > N ) return -1;
return ret;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(0);
// source code
cin >> N >> A;
ll l = 2, r = N + 1;
while(l + 2 < r){
ll lb = (2 * l + r) / 3;
ll rb = (l + 2 * r) / 3;
// ll mid = (l + r) / 2;
if(ok(rb) == -1){
r = rb;
continue;
}
if(ok(lb) == -1){
l = lb;
continue;
}
if(ok(lb) < ok(rb)) r = rb;
else l = lb;
}
// cout << l << "," << r << endl;
ll ret = ok(l);
if(ok(l + 1) != -1){
ret = min(ret, ok(l + 1));
}
// for(ll k = 2; k <= 100; k++){
// ll n = N;
// ll per = 1;
// ll time = 0;
// while(1){
// if(n <= per * (k + A)){
// time += (n - 1) / per + 1;
// break;
// }
// time += k + A;
// per *= k;
// }
// m = min(m, time);
// }
output(ret);
return 0;
} | a.cc: In function 'll ok(ll)':
a.cc:34:14: error: 'LONG_LONG_MAX' was not declared in this scope
34 | ll ret = LONG_LONG_MAX;
| ^~~~~~~~~~~~~
|
s830732093 | p03923 | C++ | #include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
if(p) cout << fixed << setprecision(p) << a << "\n";
else cout << a << "\n";
}
// end of template
ll N, A;
ll ok(ll K){
ll per = 1;
ll ret = LONG_LONG_MAX;
ll time = 0;
while(1){
if(N <= per * (2 * K + A)){
ret = min(ret, time + (N - 1) / per + 1);
}
if(N <= per * (K + A)){
ret = min(ret, time + (N - 1) / per + 1);
// time += (N - 1) / per + 1;
break;
}
time += K + A;
per *= K;
if(time > N) return -1;
}
if(ret > N ) return -1;
return ret;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(0);
// source code
cin >> N >> A;
ll l = 2, r = N + 1;
while(l + 2 < r){
ll lb = (2 * l + r) / 3;
ll rb = (l + 2 * r) / 3;
// ll mid = (l + r) / 2;
if(ok(rb) == -1){
r = rb;
continue;
}
if(ok(lb) == -1){
l = lb;
continue;
}
if(ok(lb) < ok(rb)) r = rb;
else l = lb;
}
// cout << l << "," << r << endl;
ll ret = ok(l);
if(ok(l + 1) != -1){
ret = min(ret, ok(l + 1));
}
// for(ll k = 2; k <= 100; k++){
// ll n = N;
// ll per = 1;
// ll time = 0;
// while(1){
// if(n <= per * (k + A)){
// time += (n - 1) / per + 1;
// break;
// }
// time += k + A;
// per *= k;
// }
// m = min(m, time);
// }
output(ret);
return 0;
} | a.cc: In function 'll ok(ll)':
a.cc:34:14: error: 'LONG_LONG_MAX' was not declared in this scope
34 | ll ret = LONG_LONG_MAX;
| ^~~~~~~~~~~~~
|
s051912690 | p03923 | C++ | #include "iostream"
using namespace std;
long long int N,A;
long long int dis;
long long int time;
long long int num;
long long int gain = 1;
int main() {
cin >> N >>A;
if (A == 1)dis = 2;
else dis = A;
while (num < N) {
if ((N - 1) / gain + 1 < (N - 1) / (gain*dis) + dis * 2) {
time += (N - 1) / gain + 1;
num = N;
}
else {
time += dis * 2;
gain *= dis;
}
}
cout << time << "\n";
return 0;
} | a.cc:6:15: error: 'long long int time' redeclared as different kind of entity
6 | long long int time;
| ^~~~
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:1:
/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:16:30: warning: pointer to a function used in arithmetic [-Wpointer-arith]
16 | time += (N - 1) / gain + 1;
| ~~~~~^~~~~~~~~~~~~~~~~~~~~
cc1plus: warning: pointer to a function used in arithmetic [-Wpointer-arith]
a.cc:16:30: error: assignment of read-only location 'time'
a.cc:20:30: warning: pointer to a function used in arithmetic [-Wpointer-arith]
20 | time += dis * 2;
| ~~~~~^~~~~~~~~~
a.cc:20:30: error: assignment of read-only location 'time'
|
s612765546 | p03924 | C++ | #include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#include <assert.h>
#include <bitset>
#define Endl endl
#define mp make_pair
#define ll long long
#define ull unsinged long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define over(A) {cout<<A<<endl;exit(0);}
#define all(A) A.begin(),A.end()
#define ceil(a,b) ((a-1)/b+1)
#define srand() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand(l,r) uniform_int_distribution<int>(l,r)(rng)
template <typename T1,typename T2> inline void chmin(T1 &x,T2 b) {if(b<x) x=b;}
template <typename T1,typename T2> inline void chmax(T1 &x,T2 b) {if(b>x) x=b;}
const int inf=1039074182;
const int mod=1e9+7;
using namespace std;
int dp[305][305][305];
int n,m;
namespace combinatorics
{
int *fac;
int *ifac;
int __Tmod;
inline int add(int a,int b)
{
return (a+b)%__Tmod;
}
inline int sub(int a,int b)
{
return (a-b+__Tmod)%__Tmod;
}
inline int mult(int a,int b)
{
return (1LL*a*b)%__Tmod;
}
inline int fastpow(int basic,int x)
{
if(x==0) return 1;
int res=1;
while(x)
{
if(x&1) res=mult(res,basic);
basic=mult(basic,basic);
x>>=1;
}
return res;
}
inline int inv(int x)
{
return fastpow(x,__Tmod-2);
}
void init(int n,int tmod)
{
__Tmod=tmod;
fac=new int[n+5];
ifac=new int[n+5];
fac[0]=1;
for(int i=1;i<=n;i++)
{
fac[i]=mult(fac[i-1],i);
}
ifac[n]=inv(fac[n]);
for(int i=n-1;i>=0;i--)
{
ifac[i]=mult(ifac[i+1],i+1);
}
}
inline int C(int n,int m)
{
return mult(mult(fac[n],ifac[m]),ifac[n-m]);
}
inline int Cat(int x)
{
return mult(C(x*2,x),inv(x+1));
}
};
using namespace combinatorics;
template <typename T1,typename T2> upadd(T1 &a,T2 b) {a+=b;if(a>=mod) a-=mod;}
int main()
{
// freopen("input.txt","r",stdin);
cin>>n>>m;
init(300,1e9+7);
dp[0][1][1]=1;
for(int i=0;i<m;i++)
{
for(int j=1;j<=min(i+1,n);j++)
{
for(int k=1;k<=j;k++)
{
int now=dp[i][j][k];
upadd(dp[i+1][j][j],mult(now,k));
upadd(dp[i+1][j][k],mult(now,j-k));
upadd(dp[i+1][j+1][k],mult(now,n-j));
}
}
}
cout<<dp[m][n][n]<<endl;
return 0;
} | a.cc:94:36: error: ISO C++ forbids declaration of 'upadd' with no type [-fpermissive]
94 | template <typename T1,typename T2> upadd(T1 &a,T2 b) {a+=b;if(a>=mod) a-=mod;}
| ^~~~~
a.cc: In function 'int upadd(T1&, T2)':
a.cc:94:78: warning: no return statement in function returning non-void [-Wreturn-type]
94 | template <typename T1,typename T2> upadd(T1 &a,T2 b) {a+=b;if(a>=mod) a-=mod;}
| ^
|
s823799877 | p03925 | C++ | #include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
//#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}
ll MOD=998244353;
#define N 11000000
ll int inv[N],comb[N],prd[N],invprd[N];
void calc_inv(){
inv[1]=1;
rep2(i,2,N-1){
inv[i]=((-(MOD/i)*inv[MOD%i])%MOD+MOD)%MOD;
}
return;
}
void calc_comb(ll int n){
comb[0]=1;
rep2(i,1,n){
comb[i]=comb[i-1]*(n+1-i)*inv[i]%MOD;
}
return;
}
void calc_product(){
prd[0]=prd[1]=1;
invprd[0]=invprd[1]=1;
rep2(i,2,N-1){
prd[i]=i*prd[i-1]%MOD;
invprd[i]=inv[i]*invprd[i-1]%MOD;
}
return ;
}
ll cmb(int a,int b){
if(a<b)return 0;
if(a<0||b<0)return 0;
return prd[a]*invprd[b]%MOD*invprd[a-b]%MOD;
}
ll modpow(ll x,ll n){
if(n==0) return 1;
ll res=modpow(x*x%MOD,n/2);
if(n&1) res=res*x%MOD;
return res;
}
ll p[N+100],a[N],b[N];
struct UnionFind {
vector< int > data;
UnionFind(int sz) {
data.assign(sz, -1);
}
bool unite(int x, int y) {
x = find(x), y = find(y);
if(x == y) return (false);
if(data[x] > data[y]) swap(x, y);
data[x] += data[y];
data[y] = x;
return (true);
}
int find(int k) {
if(data[k] < 0) return (k);
return (data[k] = find(data[k]));
}
int size(int k) {
return (-data[find(k)]);
}
};
struct querry{
int a,b;
ll c;
int ato;
bool operator<(const querry &x) const {
return c<x.c;};
};
main(){
int n,q;
priority_queue<querry> pq;
UnionFind uf(n);
ll ans=0;
rep(i,n){
int a,b,c;
cin>>a>>b>>c;
pq.emplace(querry{a,b,c,1});
}
while(1){
querry now=pq.top();
pq.pop();
if(uf.same(now.a,now.b)){
swap(now.a,now.b);
now.b++;now.c++;
if(now.ato){now.ato=0;pq.emplace(now);}
}
else{
uf.unite(now.a,now.b);
now.a++;
swap(now.a,now.b);
now.ato=1;
ans+=now.c;
now.c++;
pq.emplace(now);
if(uf.size(now.a)==n){
cout<<ans;return 0;}
}
}
}
| a.cc:118:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
118 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:131:11: error: 'struct UnionFind' has no member named 'same'
131 | if(uf.same(now.a,now.b)){
| ^~~~
|
s917218376 | p03925 | C++ | #include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
//#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}
ll MOD=998244353;
#define N 11000000
ll int inv[N],comb[N],prd[N],invprd[N];
void calc_inv(){
inv[1]=1;
rep2(i,2,N-1){
inv[i]=((-(MOD/i)*inv[MOD%i])%MOD+MOD)%MOD;
}
return;
}
void calc_comb(ll int n){
comb[0]=1;
rep2(i,1,n){
comb[i]=comb[i-1]*(n+1-i)*inv[i]%MOD;
}
return;
}
void calc_product(){
prd[0]=prd[1]=1;
invprd[0]=invprd[1]=1;
rep2(i,2,N-1){
prd[i]=i*prd[i-1]%MOD;
invprd[i]=inv[i]*invprd[i-1]%MOD;
}
return ;
}
ll cmb(int a,int b){
if(a<b)return 0;
if(a<0||b<0)return 0;
return prd[a]*invprd[b]%MOD*invprd[a-b]%MOD;
}
ll modpow(ll x,ll n){
if(n==0) return 1;
ll res=modpow(x*x%MOD,n/2);
if(n&1) res=res*x%MOD;
return res;
}
ll p[N+100],a[N],b[N];
struct UnionFind {
vector< int > data;
UnionFind(int sz) {
data.assign(sz, -1);
}
bool unite(int x, int y) {
x = find(x), y = find(y);
if(x == y) return (false);
if(data[x] > data[y]) swap(x, y);
data[x] += data[y];
data[y] = x;
return (true);
}
int find(int k) {
if(data[k] < 0) return (k);
return (data[k] = find(data[k]));
}
int size(int k) {
return (-data[find(k)]);
}
};
struct querry{
int a,b;
ll c;
int ato;
bool operator<(const querry &x) const {
return c<x.c;};
};
main(){
int n,q;
priority_queue<querry,vector<querry> pq;
UnionFind uf(n);
ll ans=0;
rep(i,n){
int a,b,c;
cin>>a>>b>>c;
pq.emplace(querry{a,b,c,1});
}
while(1){
querry now=pq.top();
pq.pop();
if(uf.same(now.a,now.b)){
swap(now.a,now.b);
now.b++;now.c++;
if(now.ato){now.ato=0;pq.emplace(now);}
}
else{
uf.unite(now.a,now.b);
now.a++;
swap(now.a,now.b);
now.ato=1;
ans+=now.c;
now.c++;
pq.emplace(now);
if(uf.size(now.a)==n){
cout<<ans;return 0;}
}
}
}
| a.cc:118:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
118 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:120:40: error: template argument 2 is invalid
120 | priority_queue<querry,vector<querry> pq;
| ^~
a.cc:120:40: error: template argument 3 is invalid
a.cc:126:5: error: 'pq' was not declared in this scope; did you mean 'q'?
126 | pq.emplace(querry{a,b,c,1});
| ^~
| q
a.cc:129:16: error: 'pq' was not declared in this scope; did you mean 'q'?
129 | querry now=pq.top();
| ^~
| q
a.cc:131:11: error: 'struct UnionFind' has no member named 'same'
131 | if(uf.same(now.a,now.b)){
| ^~~~
|
s798842975 | p03925 | C++ | #include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}
ll MOD=998244353;
#define N 11000000
ll int inv[N],comb[N],prd[N],invprd[N];
void calc_inv(){
inv[1]=1;
rep2(i,2,N-1){
inv[i]=((-(MOD/i)*inv[MOD%i])%MOD+MOD)%MOD;
}
return;
}
void calc_comb(ll int n){
comb[0]=1;
rep2(i,1,n){
comb[i]=comb[i-1]*(n+1-i)*inv[i]%MOD;
}
return;
}
void calc_product(){
prd[0]=prd[1]=1;
invprd[0]=invprd[1]=1;
rep2(i,2,N-1){
prd[i]=i*prd[i-1]%MOD;
invprd[i]=inv[i]*invprd[i-1]%MOD;
}
return ;
}
ll cmb(int a,int b){
if(a<b)return 0;
if(a<0||b<0)return 0;
return prd[a]*invprd[b]%MOD*invprd[a-b]%MOD;
}
ll modpow(ll x,ll n){
if(n==0) return 1;
ll res=modpow(x*x%MOD,n/2);
if(n&1) res=res*x%MOD;
return res;
}
ll p[N+100],a[N],b[N];
struct UnionFind {
vector< int > data;
UnionFind(int sz) {
data.assign(sz, -1);
}
bool unite(int x, int y) {
x = find(x), y = find(y);
if(x == y) return (false);
if(data[x] > data[y]) swap(x, y);
data[x] += data[y];
data[y] = x;
return (true);
}
int find(int k) {
if(data[k] < 0) return (k);
return (data[k] = find(data[k]));
}
int size(int k) {
return (-data[find(k)]);
}
};
struct querry{
int a,b;
ll c;
int ato;
bool operator<(const querry &x){
return c<x.c;};
};
main(){
int n,q;
priority_queue<querry,vector<querry> pq;
UnionFind uf(n);
ll ans=0;
rep(i,n){
int a,b,c;
cin>>a>>b>>c;
pq.emplace(querry{a,b,c,1});
}
while(1){
querry now=pq.top();
pq.pop();
if(uf.same(now.a,now.b)){
swap(now.a,now.b);
now.b++;now.c++;
if(now.ato){now.ato=0;pq.emplace(now);}
}
else{
uf.unite(now.a,now.b);
now.a++;
swap(now.a,now.b);
now.ato=1;
ans+=now.c;
now.c++;
pq.emplace(now);
if(uf.size(now.a)==n){
cout<<ans;return 0;}
}
}
}
| a.cc:118:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
118 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:120:25: error: two or more data types in declaration of 'type name'
120 | priority_queue<querry,vector<querry> pq;
| ^~~~~~~~~~~~~~
a.cc:32:12: error: template argument 2 is invalid
32 | #define pq priority_queue<int>
| ^~~~~~~~~~~~~~~~~~~
a.cc:120:40: note: in expansion of macro 'pq'
120 | priority_queue<querry,vector<querry> pq;
| ^~
a.cc:32:12: error: template argument 3 is invalid
32 | #define pq priority_queue<int>
| ^~~~~~~~~~~~~~~~~~~
a.cc:120:40: note: in expansion of macro 'pq'
120 | priority_queue<querry,vector<querry> pq;
| ^~
a.cc:126:7: error: expected unqualified-id before '.' token
126 | pq.emplace(querry{a,b,c,1});
| ^
a.cc:126:31: error: expected primary-expression before ')' token
126 | pq.emplace(querry{a,b,c,1});
| ^
a.cc:129:18: error: expected primary-expression before '.' token
129 | querry now=pq.top();
| ^
a.cc:130:7: error: expected unqualified-id before '.' token
130 | pq.pop();
| ^
a.cc:131:11: error: 'struct UnionFind' has no member named 'same'
131 | if(uf.same(now.a,now.b)){
| ^~~~
a.cc:134:31: error: expected unqualified-id before '.' token
134 | if(now.ato){now.ato=0;pq.emplace(now);}
| ^
a.cc:143:9: error: expected unqualified-id before '.' token
143 | pq.emplace(now);
| ^
|
s357212813 | p03925 | C++ | #include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}
ll MOD=998244353;
#define N 11000000
ll int inv[N],comb[N],prd[N],invprd[N];
void calc_inv(){
inv[1]=1;
rep2(i,2,N-1){
inv[i]=((-(MOD/i)*inv[MOD%i])%MOD+MOD)%MOD;
}
return;
}
void calc_comb(ll int n){
comb[0]=1;
rep2(i,1,n){
comb[i]=comb[i-1]*(n+1-i)*inv[i]%MOD;
}
return;
}
void calc_product(){
prd[0]=prd[1]=1;
invprd[0]=invprd[1]=1;
rep2(i,2,N-1){
prd[i]=i*prd[i-1]%MOD;
invprd[i]=inv[i]*invprd[i-1]%MOD;
}
return ;
}
ll cmb(int a,int b){
if(a<b)return 0;
if(a<0||b<0)return 0;
return prd[a]*invprd[b]%MOD*invprd[a-b]%MOD;
}
ll modpow(ll x,ll n){
if(n==0) return 1;
ll res=modpow(x*x%MOD,n/2);
if(n&1) res=res*x%MOD;
return res;
}
ll p[N+100],a[N],b[N];
struct UnionFind {
vector< int > data;
UnionFind(int sz) {
data.assign(sz, -1);
}
bool unite(int x, int y) {
x = find(x), y = find(y);
if(x == y) return (false);
if(data[x] > data[y]) swap(x, y);
data[x] += data[y];
data[y] = x;
return (true);
}
int find(int k) {
if(data[k] < 0) return (k);
return (data[k] = find(data[k]));
}
int size(int k) {
return (-data[find(k)]);
}
};
struct querry{
int a,b;
ll c;
int ato;
bool operator<(const querry &x,const querry &y){
return x.c<y.c;};
};
main(){
int n,q;
priority_queue<querry,vector<querry> pq;
UnionFind uf(n);
ll ans=0;
rep(i,n){
int a,b,c;
cin>>a>>b>>c;
pq.emplace(querry{a,b,c,1});
}
while(1){
querry now=pq.top();
pq.pop();
if(uf.same(now.a,now.b)){
swap(now.a,now.b);
now.b++;now.c++;
if(now.ato){now.ato=0;pq.emplace(now);}
}
else{
uf.unite(now.a,now.b);
now.a++;
swap(now.a,now.b);
now.ato=1;
ans+=now.c;
now.c++;
pq.emplace(now);
if(uf.size(now.a)==n){
cout<<ans;return 0;}
}
}
}
| a.cc:115:8: error: 'bool querry::operator<(const querry&, const querry&)' must have exactly one argument
115 | bool operator<(const querry &x,const querry &y){
| ^~~~~~~~
a.cc:118:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
118 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:120:25: error: two or more data types in declaration of 'type name'
120 | priority_queue<querry,vector<querry> pq;
| ^~~~~~~~~~~~~~
a.cc:32:12: error: template argument 2 is invalid
32 | #define pq priority_queue<int>
| ^~~~~~~~~~~~~~~~~~~
a.cc:120:40: note: in expansion of macro 'pq'
120 | priority_queue<querry,vector<querry> pq;
| ^~
a.cc:32:12: error: template argument 3 is invalid
32 | #define pq priority_queue<int>
| ^~~~~~~~~~~~~~~~~~~
a.cc:120:40: note: in expansion of macro 'pq'
120 | priority_queue<querry,vector<querry> pq;
| ^~
a.cc:126:7: error: expected unqualified-id before '.' token
126 | pq.emplace(querry{a,b,c,1});
| ^
a.cc:126:31: error: expected primary-expression before ')' token
126 | pq.emplace(querry{a,b,c,1});
| ^
a.cc:129:18: error: expected primary-expression before '.' token
129 | querry now=pq.top();
| ^
a.cc:130:7: error: expected unqualified-id before '.' token
130 | pq.pop();
| ^
a.cc:131:11: error: 'struct UnionFind' has no member named 'same'
131 | if(uf.same(now.a,now.b)){
| ^~~~
a.cc:134:31: error: expected unqualified-id before '.' token
134 | if(now.ato){now.ato=0;pq.emplace(now);}
| ^
a.cc:143:9: error: expected unqualified-id before '.' token
143 | pq.emplace(now);
| ^
|
s147913100 | p03925 | C++ | #include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}
ll MOD=998244353;
#define N 11000000
ll int inv[N],comb[N],prd[N],invprd[N];
void calc_inv(){
inv[1]=1;
rep2(i,2,N-1){
inv[i]=((-(MOD/i)*inv[MOD%i])%MOD+MOD)%MOD;
}
return;
}
void calc_comb(ll int n){
comb[0]=1;
rep2(i,1,n){
comb[i]=comb[i-1]*(n+1-i)*inv[i]%MOD;
}
return;
}
void calc_product(){
prd[0]=prd[1]=1;
invprd[0]=invprd[1]=1;
rep2(i,2,N-1){
prd[i]=i*prd[i-1]%MOD;
invprd[i]=inv[i]*invprd[i-1]%MOD;
}
return ;
}
ll cmb(int a,int b){
if(a<b)return 0;
if(a<0||b<0)return 0;
return prd[a]*invprd[b]%MOD*invprd[a-b]%MOD;
}
ll modpow(ll x,ll n){
if(n==0) return 1;
ll res=modpow(x*x%MOD,n/2);
if(n&1) res=res*x%MOD;
return res;
}
ll p[N+100],a[N],b[N];
struct UnionFind {
vector< int > data;
UnionFind(int sz) {
data.assign(sz, -1);
}
bool unite(int x, int y) {
x = find(x), y = find(y);
if(x == y) return (false);
if(data[x] > data[y]) swap(x, y);
data[x] += data[y];
data[y] = x;
return (true);
}
int find(int k) {
if(data[k] < 0) return (k);
return (data[k] = find(data[k]));
}
int size(int k) {
return (-data[find(k)]);
}
};
struct querry{
int a,b;
ll c;
int ato;
};
main(){
int n,q;
priority_queue<querry,vector<querry>,[](querry x,querry y){
return x.c<y.c;}> pq;
UnionFind uf(n);
ll ans=0;
rep(i,n){
int a,b,c;
cin>>a>>b>>c;
pq.emplace(querry{a,b,c,1});
}
while(1){
querry now=pq.top();
pq.pop();
if(uf.same(now.a,now.b)){
swap(now.a,now.b);
now.b++;now.c++;
if(now.ato){now.ato=0;pq.emplace(now);}
}
else{
uf.unite(now.a,now.b);
now.a++;
swap(now.a,now.b);
now.ato=1;
ans+=now.c;
now.c++;
pq.emplace(now);
if(uf.size(now.a)==n){
cout<<ans;return 0;}
}
}
}
| a.cc:116:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
116 | main(){
| ^~~~
a.cc: In function 'int main()':
a.cc:118:40: error: lambda-expression in template-argument only available with '-std=c++20' or '-std=gnu++20'
118 | priority_queue<querry,vector<querry>,[](querry x,querry y){
| ^
a.cc:119:19: error: template argument 3 is invalid
119 | return x.c<y.c;}> pq;
| ^
a.cc:119:23: error: invalid declarator before ';' token
119 | return x.c<y.c;}> pq;
| ^
a.cc:125:7: error: expected unqualified-id before '.' token
125 | pq.emplace(querry{a,b,c,1});
| ^
a.cc:125:31: error: expected primary-expression before ')' token
125 | pq.emplace(querry{a,b,c,1});
| ^
a.cc:128:18: error: expected primary-expression before '.' token
128 | querry now=pq.top();
| ^
a.cc:129:7: error: expected unqualified-id before '.' token
129 | pq.pop();
| ^
a.cc:130:11: error: 'struct UnionFind' has no member named 'same'
130 | if(uf.same(now.a,now.b)){
| ^~~~
a.cc:133:31: error: expected unqualified-id before '.' token
133 | if(now.ato){now.ato=0;pq.emplace(now);}
| ^
a.cc:142:9: error: expected unqualified-id before '.' token
142 | pq.emplace(now);
| ^
|
s364769801 | p03925 | C++ | #include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(long long i=0;i<(long long)(n);i++)
#define N (long long)210000
int p[N];
int d[N];
void init(void) {
f(i, N) {
p[i] = i;
d[i] = 1;
}
return;
}
long long pa(long long x) {
if (p[x] == x)return x;
else return p[x] = pa(p[x]);
}
void uni(long long x, long long y) {
long long px = pa(x);
long long py = pa(y);
if (px == py)return;
if (d[px] < d[py]) {
p[px] = py;
d[py] = max(d[py], d[px] + 1);
}
else {
p[py] = px;
d[px] = max(d[px], d[py] + 1);
}
return;
}
bool jud(long long x, long long y) {
long long px = pa(x);
long long py = pa(y);
if (px == py)return true;
else return false;
}
int main() {
init();
vector<pair<long long, pair<long long, long long> > >a;
long long e[N];
long long b[N];
f(i, N) {
e[i] = -1;
b[i] = -1;
}
long long n, k, m;
long long x, y, z;
long long xx, yy, zz, nn, aa;
long long s, ans;
bool v = true;
ans = 0;
scanf_s("%lld %lld", &n, &m);
f(i, m) {
scanf_s("%lld %lld %lld", &x, &y, &z);
a.push_back(make_pair(z, make_pair(x, y)));
a.push_back(make_pair(z + 1, make_pair(x + 1, y)));
}
sort(a.begin(), a.end());
xx = 0;
yy = 1;
zz = a[0].first;
nn = 0;
aa = 0;
while (true) {
if ((zz - a[0].first) % 2 == 0) {
if (aa < a.size()) {
while (a[aa].first == zz) {
e[xx] = aa + 2;
b[aa + 2] = xx;
xx = aa + 2;
aa++;
if (aa >= a.size())break;
}
}
k = 0;
while (true) {
k = e[k];
if (k == -1)break;
x = (a[k - 2].second.first + ((zz - a[k - 2].first) / 2)) % n;
y = (a[k - 2].second.second + ((zz - a[k - 2].first) / 2)) % n;
z = zz;
v = jud(x, y);
if (!v) {
uni(x, y);
ans += zz;
nn++;
if (nn + 1 == n)break;
}
else {
e[b[k]] = e[k];
if (e[k] == -1)xx = b[k];
else b[e[k]] = b[k];
}
}
if (nn + 1 == n)break;
}
else {
if (aa < a.size()) {
while (a[aa].first == zz) {
e[yy] = aa + 2;
b[aa + 2] = yy;
yy = aa + 2;
aa++;
if (aa >= a.size())break;
}
}
k = 1;
while (true) {
k = e[k];
if (k == -1)break;
x = (a[k - 2].second.first + ((zz - a[k - 2].first) / 2)) % n;
y = (a[k - 2].second.second + ((zz - a[k - 2].first) / 2)) % n;
z = zz;
v = jud(x, y);
if (!v) {
uni(x, y);
ans += zz;
nn++;
if (nn + 1 == n)break;
}
else {
e[b[k]] = e[k];
if (e[k] == -1)yy = b[k];
else b[e[k]] = b[k];
}
}
if (nn + 1 == n)break;
}
zz++;
if (nn + 1 == n)break;
}
printf("%lld\n", ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:75:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
75 | scanf_s("%lld %lld", &n, &m);
| ^~~~~~~
| scanf
|
s252217283 | p03928 | C++ | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;
template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
const int INF=1001001001;
struct MCF{
struct edge{
int to,cost,cap,rev;
edge(int to,int cap,int cost,int rev):to(to),cost(cost),cap(cap),rev(rev){}
};
int V;
vector<vector<edge>>G;
vector<int>h;
vector<int>dist;
vector<int>prevv,preve;
MCF(int v):V(v){
G.resize(V);
h.resize(V);
dist.resize(V);
prevv.resize(V);
preve.resize(V);
}
void addEdge(int from,int to,int cap,int cost){
G[from].push_back(edge(to,cap,cost,G[to].size()));
G[to].push_back(edge(from,0,-cost,G[from].size()-1));
}
int minCostFlow(int s,int t,int f){
int res=0;
fill(h.begin(),h.end(),0);
while(f>0){
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>que;
que.push({0,s});
fill(dist.begin(),dist.end(),INF);
dist[s]=0;
while(que.size()){
int c,v;
tie(c,v)=que.top();
que.pop();
if(dist[v]<c)continue;
for(int i=0;i<G[v].size();i++){
edge &e=G[v][i];
if(e.cap>0&&dist[e.to]>dist[v]+e.cost+h[v]-h[e.to]){
dist[e.to]=dist[v]+e.cost+h[v]-h[e.to];
prevv[e.to]=v;
preve[e.to]=i;
que.push({dist[e.to],e.to});
}
}
}
if(dist[t]==INF)return -1;
for(int v=0;v<V;v++){
h[v]+=dist[v];
}
int d=f;
for(int v=t;v!=s;v=prevv[v]){
d=min(d,G[prevv[v]][preve[v]].cap);
}
f-=d;
res+=d*h[t];
for(int v=t;v!=s;v=prevv[v]){
edge &e=G[prevv[v]][preve[v]];
e.cap-=d;
G[v][e.rev].cap+=d;
}
}
return res;
}
};
int N;
int U[333],D[333],L[333],R[333];
signed main(){
cin>>N;
rep(i,N)cin>>U[i];
rep(i,N)cin>>D[i];
rep(i,N)cin>>L[i];
rep(i,N)cin>>R[i];
/*
MCF mcf(N*N+4*N+2);
int src=N*N+4*N;
int snk=N*N+4*N+1;
rep(i,N){
mcf.addEdge(src,N*N+i,U[i],0);
mcf.addEdge(src,N*N+N+i,D[i],0);
mcf.addEdge(src,N*N+2*N+i,L[i],0);
mcf.addEdge(src,N*N+3*N+i,R[i],0);
}
rep(i,N)rep(j,N){
mcf.addEdge(i*N+j,snk,1,0);
mcf.addEdge(N*N+j,i*N+j,1,i);
mcf.addEdge(N*N+N+j,i*N+j,1,N-1-i);
mcf.addEdge(N*N+2*N+i,i*N+j,1,j);
mcf.addEdge(N*N+3*N+i,i*N+j,1,N-1-j);
}*/
MCF mcf(3*N*N+2);
int src=3*N*N;
int snk=3*N*N+1;
rep(i,N){
mcf.addEdge(src,i,U[i],0);
mcf.addEdge(src,(N-1)*N+i,D[i],0);
mcf.addEdge(src,N*N+i*N,L[i],0);
mcf.addEdge(src,N*N+i*N+N-1,R[i],0);
}
rep(i,N){
rep(j,N){
if(i)mcf.addEdge(i*N+j,(i-1)*N+j,INF,1);
if(i+1<N)mcf.addEdge(i*N+j,(i+1)*N+j,INF,1);
if(j)mcf.addEdge(N*N+i*N+j,N*N+i*N+j-1,INF,1);
if(j+1<N)mcf.addEdge(N*N+i*N+j,N*N+i*N+j+1,INF,1);
mcf.addEdge(i*N+j,N*N*2+i*N+j,1,0);
mcf.addEdge(N*N+i*N+j,N*N*2+i*N+j,1,0);
mcf.addEdge(N*N*2+i*N+j,snk,1,0);
}
}
int tmp=mcf.mincostFlow(src,snk,N*N);
if(tmp==-1){
cout<<"NO"<<endl;
return 0;
}
return 0;
}
| a.cc: In function 'int main()':
a.cc:144:17: error: 'struct MCF' has no member named 'mincostFlow'; did you mean 'minCostFlow'?
144 | int tmp=mcf.mincostFlow(src,snk,N*N);
| ^~~~~~~~~~~
| minCostFlow
|
s593699948 | p03928 | C++ | #include<bits/stdc++.h>
#define REP(i,m) for(int i=0;i<(m);++i)
#define REPN(i,m,in) for(int i=(in);i<(m);++i)
#define ALL(t) (t).begin(),(t).end()
#define CLR(a) memset((a),0,sizeof(a))
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
using namespace std;
#ifdef DEB
#define dump(x) cerr << #x << " = " << (x) << endl
#define prl cerr<<"called:"<< __LINE__<<endl
template<class T> void debug(T a,T b){ for(;a!=b;++a) cerr<<*a<<' ';cerr<<endl;}
#else
#define dump(x) ;
#define prl ;
template<class T> void debug(T a,T b){ ;}
#endif
template<class T> void chmin(T& a,const T& b) { if(a>b) a=b; }
template<class T> void chmax(T& a,const T& b) { if(a<b) a=b; }
typedef long long int lint;
typedef pair<int,int> pi;
namespace std{
template<class S,class T>
ostream &operator <<(ostream& out,const pair<S,T>& a){
out<<'('<<a.fr<<','<<a.sc<<')';
return out;
}
}
//const int INF=5e8;
int n;
int ar[4][305];
void ng(){
puts("NO");
exit(0);
}
int buf[305][305];//0:horizonal 1:vertical
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
//down,right,up,left
int LR[305],UD[305];
int ud[305],perm[305];
bool done[305][305];
bool vis[305][305];
bool start[305][305];
vector<pi> ever;
bool dfs(int y,int x){
ever.pb(mp(y,x));
dump(y);dump(x);
if(vis[y][x]){
prl;
int m=ever.size();
for(int i=m-1;i>=0;--i) if(ever[i]==mp(y,x)){
for(int j=m-1;j>i;--j){
int nxt=j+1;
if(nxt==m) nxt=i;
pi p=ever[j],q=ever[nxt];
swap(buf[p.fr][p.sc],buf[q.fr][q.sc]);
}
start[y][x]=1;
}
vis[y][x]=0;
return true;
}
vis[y][x]=1;
int d=buf[y][x];
int py=y+dy[d],px=x+dx[d];
while(!(px<0 || py<0 || px>=n || py>=n)){
if(!done[py][px]){
if(dfs(py,px)){
if(start[y][x]){
start[y][x]=false;
ever.pop_back();
vis[y][x]=0;
return dfs(y,x);
}else{
vis[y][x]=0;
ever.pop_back();
return true;
}
}
}
px+=dx[d],py+=dy[d];
}
done[y][x]=1;
char code[]="DRUL";
printf("%c%d\n",code[buf[y][x]],buf[y][x]&1?y+1:x+1);
ever.pop_back();
return false;
}
int main(){
cin>>n;
REP(i,4) REP(j,n) cin>>ar[i][j];
REP(i,n) if(ar[0][i]+ar[1][i]>n || ar[2][i]+ar[3][i]>n) ng();
prl;
REP(i,n){
LR[i]=ar[2][i]+ar[3][i];
UD[i]=ar[0][i]+ar[1][i];
}
REP(j,n) ud[j]=UD[j];
REP(i,n){
REP(j,n) perm[j]=j;
sort(perm,perm+n,[&](int a,int b){
return ud[a]<ud[b];
});
REP(j,n){
if(j<LR[i]) buf[i][perm[j]]=0;
else buf[i][perm[j]]=1,--ud[perm[j]];
}
}
debug(ud,ud+n);
REP(i,n) if(ud[i]!=0) ng();
prl;
REP(i,n){
REP(j,n){
if(buf[i][j]==0){
if(ar[2][i]>0) buf[i][j]=3,--ar[2][i];
else buf[i][j]=1;
}else{
if(ar[0][j]>0) buf[i][j]=2,--ar[0][j];
else buf[i][j]=0;
}
}
}
REP(i,n) REP(j,n) buf[i][j]=init[i][j];
REP(i,n) debug(buf[i],buf[i]+n);
REP(i,n) REP(j,n) if(!done[i][j]) dfs(i,j);
REP(i,n) debug(buf[i],buf[i]+n);
return 0;
}
| a.cc: In function 'int main()':
a.cc:147:31: error: 'init' was not declared in this scope; did you mean 'int'?
147 | REP(i,n) REP(j,n) buf[i][j]=init[i][j];
| ^~~~
| int
|
s010644686 | p03928 | C++ | // In the name of God
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
using namespace std;
const int N = (int) 1e5 + 5, mod = (int) 0;
int mark[N], head[N], pre[N], cap[N], to[N], en;
void nein() {
cout << "NO\n";
exit(0);
}
void add_edge(int u, int v, int uv, int vu) {
to[en] = v, cap[en] = uv, pre[en] = head[u], head[u] = en++;
to[en] = u, cap[en] = vu, pre[en] = head[v], head[v] = en++;
}
int dfs(int v, int t, int f = 1e9) {
if (v == t) return f;
if (mark[v]++) return 0;
for (int e = head[v]; ~e; e = pre[e]) {
int u = to[e];
if (cap[e]) {
int x = dfs(u, t, min(f, cap[e]));
if (x > 0) {
cap[e] -= x;
cap[e ^ 1] += x;
return x;
}
}
}
return 0;
}
int max_flow(int s, int t) {
int res = 0;
while (true) {
memset(mark, 0, sizeof mark);
int x = dfs(s, t);
if (!x) break;
res += x;
}
return res;
}
string make(char p, int x) {
x++;
string s = "";
while (x) s += x % 10 + '0', x /= 10;
reverse(s.begin(), s.end());
string res = "";
res += p;
res += s;
return res;
}
int mat[1000][1000], u[N], d[N], l[N], r[N], vis[1000][1000], up[N], dp[N], lp[N], rp[N];
int32_t main() {
memset(head, -1, sizeof head);
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin >> n;
for (int i = 0; i < n; ++i) cin >> u[i];
for (int i = 0; i < n; ++i) cin >> d[i];
for (int i = 0; i < n; ++i) cin >> l[i];
for (int i = 0; i < n; ++i) cin >> r[i];
int sum = 0;
for (int i = 0; i < n; ++i) {
lp[i] = 0;
rp[i] = n - 1;
up[i] = 0;
dp[i] = n - 1;
if (u[i] + d[i] > n) {
nein();
}
if (l[i] + r[i] > n) {
nein();
}
sum += u[i] + d[i] + l[i] + r[i];
}
if (sum != n * n) {
nein();
}
int src = 2 * n, snk = 2 * n + 1;
int sum = 0;
for (int i = 0; i < n; ++i) {
add_edge(src, i << 1 | 0, d[i] + u[i], 0);
sum += d[i] + u[i];
add_edge(i << 1 | 1, snk, n - l[i] - r[i], 0);
}
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j) {
mat[i][j] = en;
add_edge(i << 1 | 0, i << 1 | 1, 1, 0);
}
if (max_flow(src, snk) != sum) {
nein();
}
vector<string> op;
for (int step = 0; step < n * n; ++step) {
for (int i = 0; i < n; ++i) {
while (up[i] <= dp[i] && vis[up[i]][i]) up[i]++;
while (lp[i] <= rp[i] && vis[i][lp[i]]) lp[i]++;
while (dp[i] >= up[i] && vis[dp[i]][i]) dp[i]--;
while (rp[i] >= lp[i] && vis[i][rp[i]]) rp[i]--;
}
for (int i = 0; i < n; ++i) if (up[i] <= dp[i]) {
if (i == lp[up[i]]) {
if (mat[i << 1 | 0][up[i] << 1 | 1]) {
if (l[up[i]]) vis[up[i]][i] = 1, op.push_back(make('L', up[i]));
} else {
if (u[i]) vis[up[i]][i] = 1, op.push_back(make('U', i));
}
}
if (i == rp[up[i]]) {
if (mat[i << 1 | 0][up[i] << 1 | 1]) {
if (r[up[i]]) vis[up[i]][i] = 1, op.push_back(make('R', up[i]));
} else {
if (u[i]) vis[up[i]][i] = 1, op.push_back(make('U', i));
}
}
if (i == lp[dp[i]]) {
if (mat[i << 1 | 0][dp[i] << 1 | 1]) {
if (l[dp[i]]) vis[dp[i]][i] = 1, op.push_back(make('L', dp[i]));
} else {
if (d[i]) vis[dp[i]][i] = 1, op.push_back(make('D', i));
}
}
if (i == rp[dp[i]]) {
if (mat[i << 1 | 0][dp[i] << 1 | 1]) {
if (r[dp[i]]) vis[dp[i]][i] = 1, op.push_back(make('R', dp[i]));
} else {
if (d[i]) vis[dp[i]][i] = 1, op.push_back(make('D', i));
}
}
}
}
assert(op.size() == n * n);
for (auto x : op)
cout << x << '\n';
}
| a.cc: In function 'int32_t main()':
a.cc:95:9: error: redeclaration of 'int sum'
95 | int sum = 0;
| ^~~
a.cc:77:9: note: 'int sum' previously declared here
77 | int sum = 0;
| ^~~
|
s166764239 | p03928 | C++ | // In the name of God
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
using namespace std;
const int N = (int) 1e5 + 5, mod = (int) 0;
int mark[N], head[N], pre[N], cap[N], to[N], en;
void nein() {
cout << "NO\n";
exit(0);
}
void add_edge(int u, int v, int uv, int vu) {
to[en] = v, cap[en] = uv, pre[en] = head[u], head[u] = en++;
to[en] = u, cap[en] = vu, pre[en] = head[v], head[v] = en++;
}
int dfs(int v, int t, int f = 1e9) {
if (v == t) return f;
if (mark[v]++) return 0;
for (int e = head[v]; ~e; e = pre[e]) {
int u = to[e];
if (cap[e]) {
int x = dfs(u, t, min(f, cap[e]));
if (x > 0) {
cap[e] -= x;
cap[e ^ 1] += x;
return x;
}
}
}
return 0;
}
int max_flow(int s, int t) {
int res = 0;
while (true) {
memset(mark, 0, sizeof mark);
int x = dfs(s, t);
if (!x) break;
res += x;
}
return res;
}
string make(char p, int x) {
x++;
string s = "";
while (x) s += x % 10 + '0', x /= 10;
reverse(s.begin(), s.end());
string res = "";
res += p;
res += s;
return res;
}
int mat[1000][1000], u[N], d[N], l[N], r[N], vis[1000][1000], up[N], dp[N], lp[N], rp[N];
int32_t main() {
memset(head, -1, sizeof head);
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin >> n;
for (int i = 0; i < n; ++i) cin >> u[i];
for (int i = 0; i < n; ++i) cin >> d[i];
for (int i = 0; i < n; ++i) cin >> l[i];
for (int i = 0; i < n; ++i) cin >> r[i];
int sum = 0;
for (int i = 0; i < n; ++i) {
lp[i] = 0;
rp[i] = n - 1;
up[i] = 0;
dp[i] = n - 1;
if (u[i] + d[i] > n) {
nein();
}
if (l[i] + r[i] > n) {
nein();
}
sum += u[i] + d[i] + l[i] + r[i];
}
if (sum != n * n) {
nein();
}
int src = 2 * n, snk = 2 * n + 1;
int sum = 0;
for (int i = 0; i < n; ++i) {
add_edge(src, i << 1 | 0, d[i] + u[i], 0);
sum += d[i] + u[i];
add_edge(i << 1 | 1, snk, n - l[i] - r[i], 0);
}
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j) {
mat[i][j] = en;
add_edge(i << 1 | 0, i << 1 | 1, 1, 0);
}
if (max_flow(src, snk) != sum) {
nein();
}
vector<string> op;
for (int step = 0; step < n * n; ++step) {
for (int i = 0; i < n; ++i) {
while (up[i] <= dp[i] && vis[up[i]][i]) up[i]++;
while (lp[i] <= rp[i] && vis[i][lp[i]]) lp[i]++;
while (dp[i] >= up[i] && vis[dp[i]][i]) dp[i]--;
while (rp[i] >= lp[i] && vis[i][rp[i]]) rp[i]--;
}
for (int i = 0; i < n; ++i) if (up[i] <= dp[i]) {
if (i == lp[up[i]]) {
if (mat[i << 1 | 0][up[i] << 1 | 1]) {
if (l[up[i]]) vis[up[i]][i] = 1, op.push_back(make('L', up[i]));
} else {
if (u[i]) vis[up[i]][i] = 1, op.push_back(make('U', i));
}
}
if (i == rp[up[i]]) {
if (mat[i << 1 | 0][up[i] << 1 | 1]) {
if (r[up[i]]) vis[up[i]][i] = 1, op.push_back(make('R', up[i]));
} else {
if (u[i]) vis[up[i]][i] = 1, op.push_back(make('U', i));
}
}
if (i == lp[dp[i]]) {
if (mat[i << 1 | 0][dp[i] << 1 | 1]) {
if (l[dp[i]]) vis[dp[i]][i] = 1, op.push_back(make('L', dp[i]));
} else {
if (d[i]) vis[dp[i]][i] = 1, op.push_back(make('D', i));
}
}
if (i == rp[dp[i]]) {
if (mat[i << 1 | 0][dp[i] << 1 | 1]) {
if (r[dp[i]]) vis[dp[i]][i] = 1, op.push_back(make('R', dp[i]));
} else {
if (d[i]) vis[dp[i]][i] = 1, op.push_back(make('D', i));
}
}
}
}
assert(op.size() == n * n);
for (auto x : op)
cout << x << '\n';
}
| a.cc: In function 'int32_t main()':
a.cc:95:9: error: redeclaration of 'int sum'
95 | int sum = 0;
| ^~~
a.cc:77:9: note: 'int sum' previously declared here
77 | int sum = 0;
| ^~~
|
s478776810 | p03928 | C++ | // In the name of God
#include <bits/stdc++.h>
using namespace std;
const int N = (int) 1e5 + 5, mod = (int) 0;
int mark[N], head[N], pre[N], cap[N], to[N], en;
void nein() {
cout << "NO\n";
exit(0);
}
void add_edge(int u, int v, int uv, int vu) {
to[en] = v, cap[en] = uv, pre[en] = head[u], head[u] = en++;
to[en] = u, cap[en] = vu, pre[en] = head[v], head[v] = en++;
}
int dfs(int v, int t, int f = 1e9) {
if (v == t) return f;
if (mark[v]++) return 0;
for (int e = head[v]; ~e; e = pre[e]) {
int u = to[e];
if (cap[e]) {
int x = dfs(u, t, min(f, cap[e]));
if (x > 0) {
cap[e] -= x;
cap[e ^ 1] += x;
return x;
}
}
}
return 0;
}
int max_flow(int s, int t) {
int res = 0;
while (true) {
memset(mark, 0, sizeof mark);
int x = dfs(s, t);
if (!x) break;
res += x;
}
return res;
}
string make(char p, int x) {
x++;
string s = "";
while (x) s += x % 10 + '0', x /= 10;
reverse(s.begin(), s.end());
string res = "";
res += p;
res += s;
return res;
}
int mat[1000][1000], u[N], d[N], l[N], r[N], vis[N][N], up[N], dp[N], lp[N], rp[N];
int32_t main() {
memset(head, -1, sizeof head);
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin >> n;
for (int i = 0; i < n; ++i) cin >> u[i];
for (int i = 0; i < n; ++i) cin >> d[i];
for (int i = 0; i < n; ++i) cin >> l[i];
for (int i = 0; i < n; ++i) cin >> r[i];
int sum = 0;
for (int i = 0; i < n; ++i) {
lp[i] = 0;
rp[i] = n - 1;
up[i] = 0;
dp[i] = n - 1;
if (u[i] + d[i] > n) {
nein();
}
if (l[i] + r[i] > n) {
nein();
}
sum += u[i] + d[i] + l[i] + r[i];
}
if (sum != n * n) {
nein();
}
int src = 2 * n, snk = 2 * n + 1;
for (int i = 0; i < n; ++i) {
add_edge(src, i << 1 | 0, d[i] + u[i], 0);
add_edge(i << 1 | 1, snk, n - l[i] - r[i], 0);
}
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j) {
mat[i][j] = en;
add_edge(i << 1 | 0, i << 1 | 1, 1, 0);
}
vector<string> op;
for (int step = 0; step < n * n; ++step) {
for (int i = 0; i < n; ++i) {
while (up[i] <= dp[i] && vis[up[i]][i]) up[i]++;
while (lp[i] <= rp[i] && vis[i][lp[i]]) lp[i]++;
while (dp[i] >= up[i] && vis[dp[i]][i]) dp[i]--;
while (rp[i] >= lp[i] && vis[i][rp[i]]) rp[i]--;
}
for (int i = 0; i < n; ++i) if (up[i] <= dp[i]) {
if (i == lp[up[i]]) {
if (mat[i << 1 | 0][up[i] << 1 | 1]) {
if (l[up[i]]) vis[up[i]][i] = 1, op.push_back(make('L', up[i]));
} else {
if (u[i]) vis[up[i]][i] = 1, op.push_back(make('U', i));
}
}
if (i == rp[up[i]]) {
if (mat[i << 1 | 0][up[i] << 1 | 1]) {
if (r[up[i]]) vis[up[i]][i] = 1, op.push_back(make('R', up[i]));
} else {
if (u[i]) vis[up[i]][i] = 1, op.push_back(make('U', i));
}
}
if (i == lp[dp[i]]) {
if (mat[i << 1 | 0][dp[i] << 1 | 1]) {
if (l[dp[i]]) vis[dp[i]][i] = 1, op.push_back(make('L', dp[i]));
} else {
if (d[i]) vis[dp[i]][i] = 1, op.push_back(make('D', i));
}
}
if (i == rp[dp[i]]) {
if (mat[i << 1 | 0][dp[i] << 1 | 1]) {
if (r[dp[i]]) vis[dp[i]][i] = 1, op.push_back(make('R', dp[i]));
} else {
if (d[i]) vis[dp[i]][i] = 1, op.push_back(make('D', i));
}
}
}
}
for (auto x : op)
cout << x << '\n';
} | /tmp/cc4C0cCV.o: in function `main':
a.cc:(.text+0x689): relocation truncated to fit: R_X86_64_PC32 against symbol `lp' defined in .bss section in /tmp/cc4C0cCV.o
a.cc:(.text+0x6ad): relocation truncated to fit: R_X86_64_PC32 against symbol `rp' defined in .bss section in /tmp/cc4C0cCV.o
a.cc:(.text+0x6c4): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/cc4C0cCV.o
a.cc:(.text+0x6e8): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/cc4C0cCV.o
a.cc:(.text+0x986): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/cc4C0cCV.o
a.cc:(.text+0x9a0): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/cc4C0cCV.o
a.cc:(.text+0x9b7): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/cc4C0cCV.o
a.cc:(.text+0x9ce): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/cc4C0cCV.o
a.cc:(.text+0x9e9): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/cc4C0cCV.o
a.cc:(.text+0xa2e): relocation truncated to fit: R_X86_64_PC32 against symbol `lp' defined in .bss section in /tmp/cc4C0cCV.o
a.cc:(.text+0xa48): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s178467070 | p03928 | C++ | // In the name of God
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
using namespace std;
const int N = (int) 1e5 + 5, mod = (int) 0;
int mark[N], head[N], pre[N], cap[N], to[N], en;
void nein() {
cout << "NO\n";
exit(0);
}
void add_edge(int u, int v, int uv, int vu) {
to[en] = v, cap[en] = uv, pre[en] = head[u], head[u] = en++;
to[en] = u, cap[en] = vu, pre[en] = head[v], head[v] = en++;
}
int dfs(int v, int t, int f = 1e9) {
if (v == t) return f;
if (mark[v]++) return 0;
for (int e = head[v]; ~e; e = pre[e]) {
int u = to[e];
if (cap[e]) {
int x = dfs(u, t, min(f, cap[e]));
if (x > 0) {
cap[e] -= x;
cap[e ^ 1] += x;
return x;
}
}
}
return 0;
}
int max_flow(int s, int t) {
int res = 0;
while (true) {
memset(mark, 0, sizeof mark);
int x = dfs(s, t);
if (!x) break;
res += x;
}
return res;
}
string make(char p, int x) {
x++;
string s = "";
while (x) s += x % 10 + '0', x /= 10;
reverse(s.begin(), s.end());
string res = "";
res += p;
res += s;
return res;
}
int mat[1000][1000], u[N], d[N], l[N], r[N], vis[N][N], up[N], dp[N], lp[N], rp[N];
int32_t main() {
memset(head, -1, sizeof head);
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin >> n;
for (int i = 0; i < n; ++i) cin >> u[i];
for (int i = 0; i < n; ++i) cin >> d[i];
for (int i = 0; i < n; ++i) cin >> l[i];
for (int i = 0; i < n; ++i) cin >> r[i];
int sum = 0;
for (int i = 0; i < n; ++i) {
lp[i] = 0;
rp[i] = n - 1;
up[i] = 0;
dp[i] = n - 1;
if (u[i] + d[i] > n) {
nein();
}
if (l[i] + r[i] > n) {
nein();
}
sum += u[i] + d[i] + l[i] + r[i];
}
if (sum != n * n) {
nein();
}
int src = 2 * n, snk = 2 * n + 1;
for (int i = 0; i < n; ++i) {
add_edge(src, i << 1 | 0, d[i] + u[i], 0);
add_edge(i << 1 | 1, snk, n - l[i] - r[i], 0);
}
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j) {
mat[i][j] = en;
add_edge(i << 1 | 0, i << 1 | 1, 1, 0);
}
vector<string> op;
for (int step = 0; step < n * n; ++step) {
for (int i = 0; i < n; ++i) {
while (up[i] <= dp[i] && vis[up[i]][i]) up[i]++;
while (lp[i] <= rp[i] && vis[i][lp[i]]) lp[i]++;
while (dp[i] >= up[i] && vis[dp[i]][i]) dp[i]--;
while (rp[i] >= lp[i] && vis[i][rp[i]]) rp[i]--;
}
for (int i = 0; i < n; ++i) if (up[i] <= dp[i]) {
if (i == lp[up[i]]) {
if (mat[i << 1 | 0][up[i] << 1 | 1]) {
if (l[up[i]]) vis[up[i]][i] = 1, op.push_back(make('L', up[i]));
} else {
if (u[i]) vis[up[i]][i] = 1, op.push_back(make('U', i));
}
}
if (i == rp[up[i]]) {
if (mat[i << 1 | 0][up[i] << 1 | 1]) {
if (r[up[i]]) vis[up[i]][i] = 1, op.push_back(make('R', up[i]));
} else {
if (u[i]) vis[up[i]][i] = 1, op.push_back(make('U', i));
}
}
if (i == lp[dp[i]]) {
if (mat[i << 1 | 0][dp[i] << 1 | 1]) {
if (l[dp[i]]) vis[dp[i]][i] = 1, op.push_back(make('L', dp[i]));
} else {
if (d[i]) vis[dp[i]][i] = 1, op.push_back(make('D', i));
}
}
if (i == rp[dp[i]]) {
if (mat[i << 1 | 0][dp[i] << 1 | 1]) {
if (r[dp[i]]) vis[dp[i]][i] = 1, op.push_back(make('R', dp[i]));
} else {
if (d[i]) vis[dp[i]][i] = 1, op.push_back(make('D', i));
}
}
}
}
for (auto x : op)
cout << x << '\n';
} | /tmp/ccLyzVIo.o: in function `main':
a.cc:(.text+0x689): relocation truncated to fit: R_X86_64_PC32 against symbol `lp' defined in .bss section in /tmp/ccLyzVIo.o
a.cc:(.text+0x6ad): relocation truncated to fit: R_X86_64_PC32 against symbol `rp' defined in .bss section in /tmp/ccLyzVIo.o
a.cc:(.text+0x6c4): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/ccLyzVIo.o
a.cc:(.text+0x6e8): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccLyzVIo.o
a.cc:(.text+0x986): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/ccLyzVIo.o
a.cc:(.text+0x9a0): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/ccLyzVIo.o
a.cc:(.text+0x9b7): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/ccLyzVIo.o
a.cc:(.text+0x9ce): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/ccLyzVIo.o
a.cc:(.text+0x9e9): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/ccLyzVIo.o
a.cc:(.text+0xa2e): relocation truncated to fit: R_X86_64_PC32 against symbol `lp' defined in .bss section in /tmp/ccLyzVIo.o
a.cc:(.text+0xa48): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s562336103 | p03928 | C++ | // In the name of God
#include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
using namespace std;
#define prev tavas
const int N = (int) 1e5 + 5, mod = (int) 0;
int mark[N], head[N], prev[N], cap[N], to[N], en;
void nein() {
cout << "NO\n";
exit(0);
}
void add_edge(int u, int v, int uv, int vu) {
to[en] = v, cap[en] = uv, prev[en] = head[u], head[u] = en++;
to[en] = u, cap[en] = vu, prev[en] = head[v], head[v] = en++;
}
int dfs(int v, int t, int f = 1e9) {
if (v == t) return f;
if (mark[v]++) return 0;
for (int e = head[v]; ~e; e = prev[e]) {
int u = to[e];
if (cap[e]) {
int x = dfs(u, t, min(f, cap[e]));
if (x > 0) {
cap[e] -= x;
cap[e ^ 1] += x;
return x;
}
}
}
return 0;
}
int max_flow(int s, int t) {
int res = 0;
while (true) {
memset(mark, 0, sizeof mark);
int x = dfs(s, t);
if (!x) break;
res += x;
}
return res;
}
string make(char p, int x) {
x++;
string s = "";
while (x) s += x % 10 + '0', x /= 10;
reverse(s.begin(), s.end());
string res = "";
res += p;
res += s;
return res;
}
int mat[1000][1000], u[N], d[N], l[N], r[N], vis[N][N], up[N], dp[N], lp[N], rp[N];
int32_t main() {
memset(head, -1, sizeof head);
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin >> n;
for (int i = 0; i < n; ++i) cin >> u[i];
for (int i = 0; i < n; ++i) cin >> d[i];
for (int i = 0; i < n; ++i) cin >> l[i];
for (int i = 0; i < n; ++i) cin >> r[i];
int sum = 0;
for (int i = 0; i < n; ++i) {
lp[i] = 0;
rp[i] = n - 1;
up[i] = 0;
dp[i] = n - 1;
if (u[i] + d[i] > n) {
nein();
}
if (l[i] + r[i] > n) {
nein();
}
sum += u[i] + d[i] + l[i] + r[i];
}
if (sum != n * n) {
nein();
}
int src = 2 * n, snk = 2 * n + 1;
for (int i = 0; i < n; ++i) {
add_edge(src, i << 1 | 0, d[i] + u[i], 0);
add_edge(i << 1 | 1, snk, n - l[i] - r[i], 0);
}
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j) {
mat[i][j] = en;
add_edge(i << 1 | 0, i << 1 | 1, 1, 0);
}
vector<string> op;
for (int step = 0; step < n * n; ++step) {
for (int i = 0; i < n; ++i) {
while (up[i] <= dp[i] && vis[up[i]][i]) up[i]++;
while (lp[i] <= rp[i] && vis[i][lp[i]]) lp[i]++;
while (dp[i] >= up[i] && vis[dp[i]][i]) dp[i]--;
while (rp[i] >= lp[i] && vis[i][rp[i]]) rp[i]--;
}
for (int i = 0; i < n; ++i) if (up[i] <= dp[i]) {
if (i == lp[up[i]]) {
if (mat[i << 1 | 0][up[i] << 1 | 1]) {
if (l[up[i]]) vis[up[i]][i] = 1, op.push_back(make('L', up[i]));
} else {
if (u[i]) vis[up[i]][i] = 1, op.push_back(make('U', i));
}
}
if (i == rp[up[i]]) {
if (mat[i << 1 | 0][up[i] << 1 | 1]) {
if (r[up[i]]) vis[up[i]][i] = 1, op.push_back(make('R', up[i]));
} else {
if (u[i]) vis[up[i]][i] = 1, op.push_back(make('U', i));
}
}
if (i == lp[dp[i]]) {
if (mat[i << 1 | 0][dp[i] << 1 | 1]) {
if (l[dp[i]]) vis[dp[i]][i] = 1, op.push_back(make('L', dp[i]));
} else {
if (d[i]) vis[dp[i]][i] = 1, op.push_back(make('D', i));
}
}
if (i == rp[dp[i]]) {
if (mat[i << 1 | 0][dp[i] << 1 | 1]) {
if (r[dp[i]]) vis[dp[i]][i] = 1, op.push_back(make('R', dp[i]));
} else {
if (d[i]) vis[dp[i]][i] = 1, op.push_back(make('D', i));
}
}
}
}
for (auto x : op)
cout << x << '\n';
}
| /tmp/cc0sv8Fz.o: in function `main':
a.cc:(.text+0x689): relocation truncated to fit: R_X86_64_PC32 against symbol `lp' defined in .bss section in /tmp/cc0sv8Fz.o
a.cc:(.text+0x6ad): relocation truncated to fit: R_X86_64_PC32 against symbol `rp' defined in .bss section in /tmp/cc0sv8Fz.o
a.cc:(.text+0x6c4): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/cc0sv8Fz.o
a.cc:(.text+0x6e8): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/cc0sv8Fz.o
a.cc:(.text+0x986): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/cc0sv8Fz.o
a.cc:(.text+0x9a0): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/cc0sv8Fz.o
a.cc:(.text+0x9b7): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/cc0sv8Fz.o
a.cc:(.text+0x9ce): relocation truncated to fit: R_X86_64_PC32 against symbol `dp' defined in .bss section in /tmp/cc0sv8Fz.o
a.cc:(.text+0x9e9): relocation truncated to fit: R_X86_64_PC32 against symbol `up' defined in .bss section in /tmp/cc0sv8Fz.o
a.cc:(.text+0xa2e): relocation truncated to fit: R_X86_64_PC32 against symbol `lp' defined in .bss section in /tmp/cc0sv8Fz.o
a.cc:(.text+0xa48): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
|
s278442295 | p03929 | C++ | #pragma GCC optimize("O3")
#pragma GCC target("sse4");
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <functional>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
using namespace std;
using llong = long long;
llong n, k;
int main() {
cin >> n >> k;
llong ans = 0;
for (int i = 1; i <= n - 2; i++) {
for (int j = 1; j <= 5; j++) {
if ((63 * i + 9 * j + 9) % 11 == k) ans++;
}
}
cout << ans << endl;
return 0;
}
| a.cc:2:27: error: '#pragma GCC target' string is badly formed
2 | #pragma GCC target("sse4");
| ^
a.cc:2:27: error: '#pragma GCC target' string is badly formed
|
s993537272 | p03929 | C++ | #include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int n,f,s[14][8],t,h,ans;
int main()
{
scanf("%d%d",&n,&f);
for(int i=1;i<=11;i++)
for(int j=1;j<=7;j++)
{
t++;
s[i][j]=t;
}
for(int i=1;i<=11;i++)
for(int j=1;j<=7-3+1;j++)
{
t=0;
for(int k=0;k<3;k++)
for(int l=0;l<3;l++)
t+=s[(i+k-1)%11+1][j+l];
if(t%11==f)h++;
}
ans+=max(0,(n/11-1))*h;
if(n/11>0)n-=(n/11-1)*11;
for(int i=1;i<=n-3+1;i+=)
for(int j=1;j<=7-3+1;j++)
{
t=0;
for(int k=0;k<3;k++)
for(int l=0;l<3;l++)
t+=s[(i+k-1)%11+1][j+l];
if(t%11==f)ans++;
}
printf("%d\n",ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:26:27: error: expected primary-expression before ')' token
26 | for(int i=1;i<=n-3+1;i+=)
| ^
|
s905886400 | p03929 | C++ | #include<bits/stdc++.h>
using namespace std;
int n,k,ans,p;
int map[12][6]={
{4,2,0,9,7},{1,10,8,6,4},{9,7,5,3,1},
{6,4,2,0,9},{3,1,10,8,6},
{0,9,7,5,3},{8,6,4,2,0},
{5,3,1,10,8},{2,0,9,7,5},
{10,8,6,4,2},{7,5,3,1,10}};
int main(){
scanf("%d%d",&n,&k);n-=2;
p=n%11;n/=11;ans=n*5;
for(int i=0;i<p;i++)
for(int j=0;j<5;j++)
if(map[i][j]==k)ans++;
printf("%d\n",ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:15:8: error: reference to 'map' is ambiguous
15 | if(map[i][j]==k)ans++;
| ^~~
In file included from /usr/include/c++/14/map:63,
from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:152,
from a.cc:1:
/usr/include/c++/14/bits/stl_map.h:102:11: note: candidates are: 'template<class _Key, class _Tp, class _Compare, class _Alloc> class std::map'
102 | class map
| ^~~
a.cc:4:5: note: 'int map [12][6]'
4 | int map[12][6]={
| ^~~
|
s870751743 | p03929 | C++ | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
int ca[12][6]={{4,2,0,9,7},{1,10,8,6,4},{9,7,5,3,1},{6,4,2,0,9},{3,1,10,8,6},{0,9,7,5,3},{8,6,4,2,0},{5,3,1,10,8},{2,0,9,7,5},{10,8,6,4,2},{7,5,3,1,10}};
int main(){
scanf("%d%d",&n,&k);
n-=2,p=n%11,n/=11;
ans=n*5;
for(int i=0;i<p;i++)
for(int j=0;j<5;j++)
if(ca[i][j]==k) ans++;
printf("%d\n",ans);
return 0;
} | a.cc: In function 'int main()':
a.cc:9:19: error: 'n' was not declared in this scope; did you mean 'yn'?
9 | scanf("%d%d",&n,&k);
| ^
| yn
a.cc:9:22: error: 'k' was not declared in this scope
9 | scanf("%d%d",&n,&k);
| ^
a.cc:10:14: error: 'p' was not declared in this scope
10 | n-=2,p=n%11,n/=11;
| ^
a.cc:11:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
11 | ans=n*5;
| ^~~
| abs
|
s549510129 | p03929 | C++ | [1 input]:
7 7
[1 output]:
2
[2 input]:
6 0
[2 output]:
2
[3 input]:
18 10
[3 output]:
7
[4 input]:
45
[4 output]:
7 7
[5 input]:
2
[5 output]:
6 0
[6 input]:
2
[6 output]:
18 10
[7 input]:
7
[7 output]:
45
| a.cc:1:1: error: expected unqualified-id before '[' token
1 | [1 input]:
| ^
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.