Submission #43391

# Submission time Handle Problem Language Result Execution time Memory
43391 2018-03-15T17:27:47 Z yerkimbekov Nice sequence (IZhO18_sequence) C++14
0 / 100
2 ms 632 KB
// #pragma comment(linker, "/stack:200000000")
// #pragma GCC optimize("Ofast,no-stack-protector")
// #pragma GCC target("avx")
 
// timus 219263UI
//    (><)
 
#include <iostream>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <ctime>
#include <queue>
#include <vector>
#include <sstream>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include <assert.h>  
#include <string.h>
#include <algorithm>
#include <unordered_map>
 
using namespace std;
 
typedef long long ll;
 
#define y1 needtrainharder
#define f first
#define s second
#define gg exit(0)
#define sz() size()
#define pb push_back
#define mp make_pair
#define skip continue
#define all(x) x.begin(), x.end()
#define alln(x, y) x, x + y
#define boost ios_base::sync_with_stdio(0),cin.tie(NULL),cout.tie(NULL)
#define file(s) if(fopen(task".in", "r"))freopen(s".in","r",stdin),freopen(s".out","w",stdout);
#define task "sorting"
 
const int inf = 1e9 + 5;  
const ll infll = 1e18 + 5ll;  
const long double eps = 1e-9;
const int maxn = 1e5 + 100;
const ll maxlog = 21;
const int P = 97;
const int mod = 1e9 + 7;   

/*
Izho Eshka
*/

int t, n, m;

int main() {
  file(task);
  
  cin >> t;
  while (t--) {
    cin >> n >> m;
    if (max(n, m) % min(n, m) == 0) {
      cout << max(n, m) - 1 << '\n';
      if (n > m) {
        for (int i = 1; i <= n - 1; ++i)
          cout << (i&1?2:3) * (i&1?-1:1) << ' ';
      } else {
        for (int i = 1; i <= m - 1; ++i)
          cout << ((i&1)?2:3) * (!(i&1)?-1:1) << ' ';
      }
      cout << '\n';
    } else {
      cout << 0 << '\n';
    }
  }


  return 0;
}                
/*


*/  

Compilation message

sequence.cpp: In function 'int main()':
sequence.cpp:40:95: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
 #define file(s) if(fopen(task".in", "r"))freopen(s".in","r",stdin),freopen(s".out","w",stdout);
                                                                                               ^
sequence.cpp:58:3: note: in expansion of macro 'file'
   file(task);
   ^
sequence.cpp:40:95: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
 #define file(s) if(fopen(task".in", "r"))freopen(s".in","r",stdin),freopen(s".out","w",stdout);
                                                                                               ^
sequence.cpp:58:3: note: in expansion of macro 'file'
   file(task);
   ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 356 KB Jury has the better answer : jans = 3, pans = 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 356 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 632 KB Jury has the better answer : jans = 3, pans = 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB there is incorrect sequence
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 248 KB there is incorrect sequence
2 Halted 0 ms 0 KB -