제출 #339005

#제출 시각아이디문제언어결과실행 시간메모리
339005beksultan04움직이는 개미 (IZhO12_ants)C++14
0 / 100
2 ms364 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pii pair<int,int> #define OK puts("OK"); #define NO puts("NO"); #define YES puts("YES"); #define fr first #define sc second #define ret return #define scan1(a) scanf("%lld",&a); #define scan2(a,b) scanf("%lld %lld",&a, &b); #define scan3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c); #define all(s) s.begin(),s.end() #define allr(s) s.rbegin(),s.rend() #define pb push_back #define sz(v) (int)v.size() #define endi puts(""); const int N = 1e6+12,INF=1e9+7; int dp[200][200],w[N]; deque <pair<pii,int>> v[3]; main(){ int n,m,k,t,i,j; scan2(n,m) scan2(k,t) for (i=1;i<=k;++i){ int x,y,a; scan3(x,y,a) if (a == 1){ x += (t%(n*2)); if (x >= n){ a=3; x = n - (x - n); } w[i] = 1; } else if (a == 2){ y += (t%(m*2)); if (y >= m){ a = 4; y = m-(y-m); } w[i]=2; } else if (a == 3){ x -= (t%(n*2)); if (x <= 0){ a=1; x = (n - (x+n)); } w[i]=1; } else if (a == 4){ y -= (t%(m*2)); if (y <= 0){ y = m - (m + y); a = 2; } w[i]=2; } v[w[i]] .pb({{x,y},a}); } sort(all(v[1])); sort(all(v[2])); for (i=1;i<=k;++i){ cout <<v[w[i]][0].fr.fr<<" "; cout <<v[w[i]][0].fr.sc<<" "; cout <<v[w[i]][0].sc<<"\n"; v[w[i]].pop_front(); } }

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

ants.cpp:22:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   22 | main(){
      |      ^
ants.cpp: In function 'int main()':
ants.cpp:23:19: warning: unused variable 'j' [-Wunused-variable]
   23 |     int n,m,k,t,i,j;
      |                   ^
ants.cpp:12:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   12 | #define scan2(a,b) scanf("%lld %lld",&a, &b);
      |                    ~~~~~^~~~~~~~~~~~~~~~~~~~
ants.cpp:24:5: note: in expansion of macro 'scan2'
   24 |     scan2(n,m)
      |     ^~~~~
ants.cpp:12:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   12 | #define scan2(a,b) scanf("%lld %lld",&a, &b);
      |                    ~~~~~^~~~~~~~~~~~~~~~~~~~
ants.cpp:25:5: note: in expansion of macro 'scan2'
   25 |     scan2(k,t)
      |     ^~~~~
ants.cpp:13:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   13 | #define scan3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c);
      |                      ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
ants.cpp:28:9: note: in expansion of macro 'scan3'
   28 |         scan3(x,y,a)
      |         ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...