QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#256759#7758. Painterucup-team1951#TL 1ms3392kbC++172.7kb2023-11-18 21:30:202023-11-18 21:30:21

Judging History

你现在查看的是最新测评结果

  • [2023-11-18 21:30:21]
  • 评测
  • 测评结果:TL
  • 用时:1ms
  • 内存:3392kb
  • [2023-11-18 21:30:20]
  • 提交

answer

// g++-13 3.cpp -std=c++17 -O2 -I .
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using ld = long double;
 
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vld = vector<ld>;
using vvld = vector<vld>;
using vst = vector<string>;
using vvst = vector<vst>;
 
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define pq_big(T) priority_queue<T,vector<T>,less<T>>
#define pq_small(T) priority_queue<T,vector<T>,greater<T>>
#define all(a) a.begin(),a.end()
#define rep(i,start,end) for(ll i=start;i<(ll)(end);i++)
#define per(i,start,end) for(ll i=start;i>=(ll)(end);i--)
#define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end())

//////////////// 以下を貼る ////////////////
template<class T> size_t HashCombine(const size_t seed,const T &v){
    return seed^(std::hash<T>()(v)+0x9e3779b9+(seed<<6)+(seed>>2));
}
/* pair用 */
template<class T,class S> struct std::hash<std::pair<T,S>>{
    size_t operator()(const std::pair<T,S> &keyval) const noexcept {
        return HashCombine(std::hash<T>()(keyval.first), keyval.second);
    }
};
////////////////////////////////////////////

struct S{
  string q;
  ll v1,v2,v3,v4,v5;
};

int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int n;cin>>n;
  vector<S> query(n);
  vector<pair<ll,ll>> need;

  rep(i,0,n){
    cin>>query[i].q;
    cin>>query[i].v1>>query[i].v2>>query[i].v3;
    if(query[i].q=="Circle"){
      char c;cin>>c;
      query[i].v4=int(c);
    }
    if(query[i].q=="Rectangle"){
      cin>>query[i].v4;
      char c;cin>>c;
      query[i].v5=int(c);
    }
    if(query[i].q=="Render"){
      cin>>query[i].v4;
      rep(j,query[i].v1,query[i].v3+1){
        rep(k,query[i].v2,query[i].v4+1){
          need.emplace_back(j,k);
        }
      }
    }
  }

  uniq(need);
  unordered_map<pair<ll,ll>,int> mp;
  for(auto [j,k]:need)mp[{j,k}]=46;

  rep(i,0,n){
    // cout<<i<<" ::: "<<query[i].q<<endl;
    if(query[i].q=="Circle"){
      for(auto [j,k]:need){
        if((j-query[i].v1)*(j-query[i].v1)+(k-query[i].v2)*(k-query[i].v2)<=query[i].v3*query[i].v3){
          mp[{j,k}]=query[i].v4;
        }
      }
    }
    if(query[i].q=="Rectangle"){
      rep(j,query[i].v1,query[i].v3+1){
        rep(k,query[i].v2,query[i].v4+1){
          mp[{j,k}]=query[i].v5;
        }
      }
    }
    if(query[i].q=="Render"){
      // cout<<i<<" : "<<query[i].v1<<" "<<query[i].v2<<endl;
      per(k,query[i].v4,query[i].v2){
        rep(j,query[i].v1,query[i].v3+1){
          cout<<(char)(mp[{j,k}]);
        }
        cout<<"\n";
      }
    }
  }
}

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3392kb

input:

7
Circle 0 0 5 *
Circle -2 2 1 @
Circle 2 2 1 @
Rectangle 0 -1 0 0 ^
Rectangle -2 -2 2 -2 _
Render -5 -5 5 5
Render -1 0 1 2

output:

.....*.....
..*******..
.**@***@**.
.*@@@*@@@*.
.**@***@**.
*****^*****
.****^****.
.**_____**.
.*********.
..*******..
.....*.....
@*@
***
*^*

result:

ok 14 lines

Test #2:

score: -100
Time Limit Exceeded

input:

10
Rectangle -4262 2204 3116 9357 U
Circle 7078 6883 4684 W
Rectangle 390 675 1195 1251 =
Rectangle 78 2138 3288 2570 5
Rectangle -874 797 -99 1440 3
Render 7261 -4311 7304 -4268
Render 2060 9253 2103 9296
Render -1379 -7141 -1336 -7098
Render 982 5708 1025 5751
Render 1080 -9592 1123 -9549

output:


result: