이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,t,n,x,y,m;
vector<int>v1,v2,v3;
bool ifstar=1,iftree=1;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>n>>m;
srand(692137);
for(int i=0;i<m;i++){
cin>>a>>b;
if(a!=0 || b!=i+1)
ifstar=0;
if(a!=i || b!=i+1)
iftree=0;
}
if(m==n*(n-1)/2)
iftree=1;
if(iftree){
for(int i=0;i<n;i++){
v1.push_back(i/2);
v2.push_back((i+1)/2);
}
cout<<600<<"\n";
for(int i=0;i<600;i++){
if(i&1)
for(int j=0;j<v1.size();j++)
cout<<v1[j]<<" ";
else
for(int j=0;j<v2.size();j++)
cout<<v2[j]<<" ";
cout<<"\n";
}}
else if(ifstar){
for(int i=0;i<n;i++)
v3.push_back(i);
cout<<2*n-2+1<<"\n";
for(int i=0;i<n;i++)
cout<<0<<" ";
cout<<"\n";
for(int i=1;i<n;i++){
for(int j=0;j<n;j++){
if(j==i)
cout<<0<<" ";
else
cout<<v3[j]<<" ";
}
cout<<"\n";
for(int j=0;j<n;j++){
if(j==i)
cout<<0<<" ";
else
cout<<v3[j]<<" ";
}
cout<<"\n";
}
}
else{
for(int i=0;i<2000;i++){
for(int i=0;i<n;i++)
cout<<rand()%(n/2)<<" ";
cout<<"\n";
}
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp: In function 'int main()':
Main.cpp:30:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
30 | for(int j=0;j<v1.size();j++)
| ~^~~~~~~~~~
Main.cpp:33:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
33 | for(int j=0;j<v2.size();j++)
| ~^~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |