Submission #3524725
Source Code Expand
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;
long long MOD = 1000000007;
int main() {
int N;
cin >> N;
if ( N == 1 ) {
cout << "Yes" << endl;
cout << 2 << endl;
cout << 1 << " " << 1 << endl;
cout << 1 << " " << 1 << endl;
return 0;
}
long long z;
for ( long long i = 3; i < 1000; i++ ) {
long long a = i*(i-1)/2;
if ( a > N ) { cout << "No" << endl; return 0; }
if ( a == N ) { z = i; cout << "Yes" << endl; break; }
}
cout << z << endl;
vector< vector<int> > A(z);
long long x = 1;
for ( long long a = 0; a < z; a++ ) {
for ( long long b = a+1; b < z; b++ ) {
A[a].push_back(x);
A[b].push_back(x);
x++;
}
}
for ( int i = 0; i < z; i++ ) {
cout << A[i].size() << " ";
for ( int j = 0; j < A[i].size(); j++ ) {
cout << A[i][j];
if ( j != A[i].size()-1 ) { cout << " "; }
}
cout << endl;
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | D - Crossing |
| User | tetsuzuki1115 |
| Language | C++14 (GCC 5.4.1) |
| Score | 500 |
| Code Size | 1328 Byte |
| Status | AC |
| Exec Time | 20 ms |
| Memory | 2304 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 500 / 500 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | s1.txt, s2.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, s1.txt, s2.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | AC | 1 ms | 256 KiB |
| 02.txt | AC | 1 ms | 256 KiB |
| 03.txt | AC | 1 ms | 256 KiB |
| 04.txt | AC | 1 ms | 256 KiB |
| 05.txt | AC | 1 ms | 256 KiB |
| 06.txt | AC | 1 ms | 256 KiB |
| 07.txt | AC | 1 ms | 256 KiB |
| 08.txt | AC | 1 ms | 256 KiB |
| 09.txt | AC | 1 ms | 256 KiB |
| 10.txt | AC | 1 ms | 256 KiB |
| 11.txt | AC | 18 ms | 2176 KiB |
| 12.txt | AC | 20 ms | 2304 KiB |
| 13.txt | AC | 1 ms | 256 KiB |
| 14.txt | AC | 1 ms | 256 KiB |
| 15.txt | AC | 1 ms | 256 KiB |
| 16.txt | AC | 1 ms | 256 KiB |
| 17.txt | AC | 1 ms | 256 KiB |
| 18.txt | AC | 3 ms | 384 KiB |
| 19.txt | AC | 8 ms | 1152 KiB |
| 20.txt | AC | 1 ms | 256 KiB |
| 21.txt | AC | 12 ms | 1536 KiB |
| 22.txt | AC | 10 ms | 1408 KiB |
| 23.txt | AC | 1 ms | 256 KiB |
| 24.txt | AC | 1 ms | 256 KiB |
| s1.txt | AC | 1 ms | 256 KiB |
| s2.txt | AC | 1 ms | 256 KiB |