提出 #33814276
ソースコード 拡げる
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <stack>
#include <numeric>
#include <cassert>
#include <climits>
#include <limits>
//Binary Indexed Tree
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/tag_and_trait.hpp>
// using namespace __gnu_pbds;
//Binary Indexed Tree
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using namespace std;
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
//iostream operator
template <typename T> istream &operator>>(istream &is, vector<T> &x){for (auto &y:x){is >> y;} return is;}
template <typename T> ostream &operator<<(ostream &os, vector<T> &x){for (size_t e = 0; e < x.size(); e++){os << x[e] << (e==x.size()-1?"":" ");} return os;}
template <class T, class S> istream &operator>>(istream &is, pair<T, S> &x){is >> x.first >> x.second; return is;}
template <class T, class S> ostream &operator<<(ostream &os, pair<T, S> &x){os << x.first << " " << x.second; return os;}
//iostream operator
namespace cpio{
//Debug out
void dout(){cerr << "\n";}
template<typename T, typename... Ts> void dout(const T& a, const Ts&... b){cerr << a; (cerr << ... << (cerr << ' ', b)); cerr << "\n";}
//Yes or No
void yon(bool yorn, string Y = "Yes", string N = "No"){cout << (yorn?Y:N) << endl;}
}; using namespace cpio;
namespace cpmath{
//Math library for Competitive-Programming
constexpr ll mod97 = 1000000007;
constexpr ll mod99 = 1000000009;
constexpr ll mod89 = 998244353;
constexpr double pi = acos(-1);
const int imax = numeric_limits<int>::max();
const long long llmax = numeric_limits<long long>::max();
constexpr int DX4[4] = {1, 0, -1, 0};
constexpr int DY4[4] = {0, 1, 0, -1};
constexpr int DX8[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
constexpr int DY8[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
//Return a!/(b-1)! = a*(a-1)*...*(b+1)*b, O(a)
ll factorial(ll a, ll b = -1, const ll fmod = -1){
ll ans = 1;
if (fmod > 1) {
if (b == -1) for (ll i = a; i > 1; i--) ans = ((ans%fmod)*(i%fmod))%fmod;
else for (ll i = a; i >= b; i--) ans = ((ans%fmod)*(i%fmod))%fmod;
}
else{
if (b == -1) for (ll i = a; i > 1; i--) ans = ans*i;
else for(ll i = a; i >= b; i--) ans = ans*i;
}
return ans;
}
//Return m^p, O(log p)
ll fastpow(ll m, ll p){
if (p == 0) return 1;
if (p%2 == 0){ll t = fastpow(m, p/2); return t*t;}
return m*fastpow(m, p-1);
}
ll modpow(ll m, ll p, const ll fmod){
if (p == 0) return 1;
if (p%2 == 0){ll t = modpow(m, p/2, fmod); return (t*t)%fmod;}
return (m*modpow(m, p-1, fmod))%fmod;
}
ld dtor(const ld deg){return deg*(pi/(ld)180);}
template<class T> double fmedian(vector<T> a){return (static_cast<double>(a[((int(a.size())+1)/2)-1])+static_cast<double>(a[(int(a.size())/2)]))/2;}
template<class T> pair<long long, long long> imedian(vector<T> a) {
return {
(static_cast<long long>(a[((int(a.size())+1)/2)-1])+static_cast<long long>(a[(int(a.size())/2)]))/2LL,
(static_cast<long long>(a[((int(a.size())+1)/2)-1])+static_cast<long long>(a[(int(a.size())/2)])+1)/2LL,
};
}
long long inversed(ll n, const ll mod){return cpmath::modpow(n, mod-2, mod);}
}
using cpmath::mod89;
using cpmath::mod97;
using cpmath::mod99;
using cpmath::imax;
using cpmath::llmax;
using cpmath::DX4;
using cpmath::DY4;
//using cpmath::DX8;
//using cpmath::DY8;
// using gtree = tree<T, null_type, greater<T>, rb_tree_tag, tree_order_statistics_node_update>;
int n, m;
void dfs(int b, vector<int> now){
if (now.size() == n){
cout << now << endl;
return;
}
else{
for (int i = b+1; i <= m; i++){
vector<int> cp = now;
cp.push_back(i);
dfs(i, cp);
}
}
}
int main(){
cin >> n >> m;
dfs(0, {});
}
提出情報
コンパイルエラー
./Main.cpp: In function ‘void dfs(int, std::vector<int>)’:
./Main.cpp:119:20: warning: comparison of integer expressions of different signedness: ‘std::vector<int>::size_type’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
119 | if (now.size() == n){
| ~~~~~~~~~~~^~~~
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
300 / 300 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
example_00.txt, example_01.txt |
| All |
example_00.txt, example_01.txt, test_00.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| example_00.txt |
AC |
13 ms |
3532 KiB |
| example_01.txt |
AC |
2 ms |
3492 KiB |
| test_00.txt |
AC |
2 ms |
3552 KiB |
| test_01.txt |
AC |
2 ms |
3608 KiB |
| test_02.txt |
AC |
2 ms |
3540 KiB |
| test_03.txt |
AC |
2 ms |
3448 KiB |
| test_04.txt |
AC |
2 ms |
3448 KiB |
| test_05.txt |
AC |
2 ms |
3444 KiB |
| test_06.txt |
AC |
2 ms |
3384 KiB |
| test_07.txt |
AC |
2 ms |
3540 KiB |
| test_08.txt |
AC |
2 ms |
3552 KiB |
| test_09.txt |
AC |
2 ms |
3540 KiB |
| test_10.txt |
AC |
2 ms |
3620 KiB |
| test_11.txt |
AC |
2 ms |
3452 KiB |
| test_12.txt |
AC |
2 ms |
3576 KiB |
| test_13.txt |
AC |
2 ms |
3500 KiB |
| test_14.txt |
AC |
3 ms |
3436 KiB |