제출 #373189

#제출 시각아이디문제언어결과실행 시간메모리
373189samsZoltan (COCI16_zoltan)C++14
0 / 140
775 ms65540 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int mod = 1e9+7, maxn = 2e5+10; int n, v[maxn]; map<ll, bool> ck; int main() { scanf("%d", &n); vector<int> g; for(int i = 1 ; i <=n ; ++i) scanf("%d", &v[i]); // checar todas as posições vector<ll> row1, row2, ver; row1.push_back(v[1]); for(int i = 2 ; i <= n ; ++i) { for(auto j: row1) { ll num = j * 10 + v[i]; if(!ck[num]) { ck[num] = 1; if(i == n) ver.push_back(num); else row2.push_back(num); } ll y = j; num = 1; while(y > 0) { ll a = y % 10; y -= a; y /= 10; num *= 10; } num *= v[i]; num += j; if(!ck[num]) { ck[num] = 1; if(i == n) ver.push_back(num); else row2.push_back(num); } } row1.clear(); row1 = row2; row2.clear(); } cout << ver.size() << '\n'; for(auto x: ver) { cout << x << '\n'; } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

zoltan.cpp: In function 'int main()':
zoltan.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   14 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
zoltan.cpp:18:40: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   18 |     for(int i = 1 ; i <=n ; ++i)  scanf("%d", &v[i]);
      |                                   ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...