Submission #334393

#TimeUsernameProblemLanguageResultExecution timeMemory
334393beksultan04Gift (IZhO18_nicegift)C++14
0 / 100
211 ms4204 KiB
#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("%d",&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 (stderr)

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: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("%d",&a);
      |                  ~~~~~^~~~~~~~~
nicegift.cpp:23:9: note: in expansion of macro 'scan1'
   23 |         scan1(q[i])
      |         ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...