Submission #334391

# Submission time Handle Problem Language Result Execution time Memory
334391 2020-12-09T05:49:36 Z beksultan04 Gift (IZhO18_nicegift) C++14
0 / 100
180 ms 4180 KB
#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define pii pair<int,int>
#define OK puts("OK");
#define fr first
#define sc second
#define ret return
#define scan1(a) scanf("%lld",&a);
#define scan2(a,b) scanf("%d %d",&a, &b);
#define scan3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
#define all(s) s.begin(),s.end()
#define pb push_back
#define endi puts("");
const int N = 1e6+12,INF=1e9+7;
long long sum=0;
int q[N];
main(){

    int i,j,ans=1,n,m;
    scan2(n,m)
    for (i=0;i<n;++i){
        scan1(q[i])
        sum+=q[i];
    }
    if (sum%m == 0){
        printf("%lld\n",sum/m);
        while (sum > 0){
            sum -= q[0]*m;
            int c=0;
            printf("%d ",q[0]);
            while (c < m){
                c++;
                printf("%d ",ans++);
            }
            endi
        }
    }
    else {
        cout <<-1;
    }

}


















Compilation message

nicegift.cpp:18:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   18 | main(){
      |      ^
nicegift.cpp: In function 'int main()':
nicegift.cpp:9:24: warning: format '%lld' expects argument of type 'long long int*', but argument 2 has type 'int*' [-Wformat=]
    9 | #define scan1(a) scanf("%lld",&a);
      |                        ^~~~~~ ~~~~
      |                               |
      |                               int*
   10 | #define scan2(a,b) scanf("%d %d",&a, &b);
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   11 | #define scan3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   12 | #define all(s) s.begin(),s.end()
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   13 | #define pb push_back
      | ~~~~~~~~~~~~~~~~~~~~    
   14 | #define endi puts("");
      | ~~~~~~~~~~~~~~~~~~~~~~  
   15 | const int N = 1e6+12,INF=1e9+7;
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   16 | long long sum=0;
      | ~~~~~~~~~~~~~~~~        
   17 | int q[N];
      | ~~~~~~~~~               
   18 | main(){
      | ~~~~~~~                 
   19 | 
      |                         
   20 |     int i,j,ans=1,n,m;
      |     ~~~~~~~~~~~~~~~~~~  
   21 |     scan2(n,m)
      |     ~~~~~~~~~~          
   22 |     for (i=0;i<n;++i){
      |     ~~~~~~~~~~~~~~~~~~  
   23 |         scan1(q[i])
      |         ~~~~~~~~~~      
nicegift.cpp:23:9: note: in expansion of macro 'scan1'
   23 |         scan1(q[i])
      |         ^~~~~
nicegift.cpp:9:28: note: format string is defined here
    9 | #define scan1(a) scanf("%lld",&a);
      |                         ~~~^
      |                            |
      |                            long long int*
      |                         %d
nicegift.cpp:20:11: warning: unused variable 'j' [-Wunused-variable]
   20 |     int i,j,ans=1,n,m;
      |           ^
nicegift.cpp:10:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 | #define scan2(a,b) scanf("%d %d",&a, &b);
      |                    ~~~~~^~~~~~~~~~~~~~~~
nicegift.cpp:21:5: note: in expansion of macro 'scan2'
   21 |     scan2(n,m)
      |     ^~~~~
nicegift.cpp:9:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    9 | #define scan1(a) scanf("%lld",&a);
      |                  ~~~~~^~~~~~~~~~~
nicegift.cpp:23:9: note: in expansion of macro 'scan1'
   23 |         scan1(q[i])
      |         ^~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Integer 5 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Integer 5 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Integer 5 violates the range [1, 4]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 180 ms 4180 KB Expected int32, but "-363689984000000" found
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Integer 5 violates the range [1, 4]
2 Halted 0 ms 0 KB -